12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #if defined(LIBM_SCCS) && !defined(lint)
- static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $";
- #endif
- #include "math.h"
- #include "math_private.h"
- libm_hidden_proto(fabs)
- libm_hidden_proto(logb)
- #ifdef __STDC__
- double logb(double x)
- #else
- double logb(x)
- double x;
- #endif
- {
- 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>>=20)==0)
- return -1022.0;
- else
- return (double) (ix-1023);
- }
- libm_hidden_def(logb)
|