Blame sysdeps/ieee754/flt-32/s_frexpf.c
|
Packit |
6c4009 |
/* s_frexpf.c -- float version of s_frexp.c.
|
|
Packit |
6c4009 |
* Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
/*
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
Packit |
6c4009 |
*
|
|
Packit |
6c4009 |
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
Packit |
6c4009 |
* Permission to use, copy, modify, and distribute this
|
|
Packit |
6c4009 |
* software is freely granted, provided that this notice
|
|
Packit |
6c4009 |
* is preserved.
|
|
Packit |
6c4009 |
* ====================================================
|
|
Packit |
6c4009 |
*/
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#if defined(LIBM_SCCS) && !defined(lint)
|
|
Packit |
6c4009 |
static char rcsid[] = "$NetBSD: s_frexpf.c,v 1.5 1995/05/10 20:47:26 jtc Exp $";
|
|
Packit |
6c4009 |
#endif
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
#include <math.h>
|
|
Packit |
6c4009 |
#include <math_private.h>
|
|
Packit |
6c4009 |
#include <libm-alias-float.h>
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
static const float
|
|
Packit |
6c4009 |
two25 = 3.3554432000e+07; /* 0x4c000000 */
|
|
Packit |
6c4009 |
|
|
Packit |
6c4009 |
float __frexpf(float x, int *eptr)
|
|
Packit |
6c4009 |
{
|
|
Packit |
6c4009 |
int32_t hx,ix;
|
|
Packit |
6c4009 |
GET_FLOAT_WORD(hx,x);
|
|
Packit |
6c4009 |
ix = 0x7fffffff&hx;
|
|
Packit |
6c4009 |
*eptr = 0;
|
|
Packit |
6c4009 |
if(ix>=0x7f800000||(ix==0)) return x + x; /* 0,inf,nan */
|
|
Packit |
6c4009 |
if (ix<0x00800000) { /* subnormal */
|
|
Packit |
6c4009 |
x *= two25;
|
|
Packit |
6c4009 |
GET_FLOAT_WORD(hx,x);
|
|
Packit |
6c4009 |
ix = hx&0x7fffffff;
|
|
Packit |
6c4009 |
*eptr = -25;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
*eptr += (ix>>23)-126;
|
|
Packit |
6c4009 |
hx = (hx&0x807fffff)|0x3f000000;
|
|
Packit |
6c4009 |
SET_FLOAT_WORD(x,hx);
|
|
Packit |
6c4009 |
return x;
|
|
Packit |
6c4009 |
}
|
|
Packit |
6c4009 |
libm_alias_float (__frexp, frexp)
|