e_log2.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/* @(#)e_log.c 1.3 95/01/18 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunSoft, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#include <LibConfig.h>
#include <sys/EfiCdefs.h>
#endif
#include "math.h"
#include "math_private.h"
#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */
// potential divide by 0 -- near line 53, (x-x)/zero is on purpose
#endif
static const double
ln2 = 0.6931471805599452862268,
static const double zero = 0.0;
double
__ieee754_log2(double x)
{
k=0;
GET_HIGH_WORD(hx,x);
}
if (hx >= 0x7ff00000) return x+x;
hx &= 0x000fffff;
k += (i>>20);
f = x-1.0;
dk = (double)k;
if (f==zero)
return (dk);
R = f*f*(0.5-0.33333333333333333*f);
}
s = f/(2.0+f);
z = s*s;
i = hx-0x6147a;
w = z*z;
j = 0x6b851-hx;
i |= j;
if(i>0) {
hfsq=0.5*f*f;
} else
}