00001
#if !defined(__ppc__)
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
#if defined(LIBM_SCCS) && !defined(lint)
00015
static char rcsid[] =
"$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $";
00016
#endif
00017
00018
00019
00020
00021
00022
00023
00024
#include "math.h"
00025
#include "mathP.h"
00026
00027
#ifdef __STDC__
00028
double logb(
double x)
00029 #
else
00030 double logb(x)
00031 double x;
00032 #endif
00033 {
00034 int32_t lx,ix;
00035
EXTRACT_WORDS(ix,lx,x);
00036 ix &= 0x7fffffff;
00037
if((ix|lx)==0)
return -1.0/
fabs(x);
00038
if(ix>=0x7ff00000)
return x*x;
00039
if((ix>>=20)==0)
00040
return -1022.0;
00041
else
00042
return (
double) (ix-1023);
00043 }
00044
#endif