12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "cdefs-compat.h"
- #include <float.h>
- #include "openlibm.h"
- #include "math_private.h"
- static const double
- two54 = 1.80143985094819840000e+16;
- double
- logb(double x)
- {
- int32_t lx,ix;
- EXTRACT_WORDS(ix,lx,x);
- ix &= 0x7fffffff;
- if((ix|lx)==0) return -1.0/fabs(x);
- if(ix>=0x7ff00000) return x*x;
- if(ix<0x00100000) {
- x *= two54;
- GET_HIGH_WORD(ix,x);
- ix &= 0x7fffffff;
- return (double) ((ix>>20)-1023-54);
- } else
- return (double) ((ix>>20)-1023);
- }
- #if (LDBL_MANT_DIG == 53)
- __weak_reference(logb, logbl);
- #endif
|