12116Sjkh/*
22116Sjkh * ====================================================
32116Sjkh * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
42116Sjkh *
52116Sjkh * Developed at SunPro, a Sun Microsystems, Inc. business.
62116Sjkh * Permission to use, copy, modify, and distribute this
78870Srgrimes * software is freely granted, provided that this notice
82116Sjkh * is preserved.
92116Sjkh * ====================================================
102116Sjkh */
112116Sjkh
12176451Sdas#include <sys/cdefs.h>
13176451Sdas__FBSDID("$FreeBSD$");
142116Sjkh
15216247Sdas/*
16226376Sdas * Float version of k_log.h.  See the latter for most comments.
17216210Sdas */
182116Sjkh
192116Sjkhstatic const float
20152335Sbde/* |(log(1+s)-log(1-s))/s - Lg(s)| < 2**-34.24 (~[-4.95e-11, 4.97e-11]). */
21152335SbdeLg1 =      0xaaaaaa.0p-24,	/* 0.66666662693 */
22152335SbdeLg2 =      0xccce13.0p-25,	/* 0.40000972152 */
23152335SbdeLg3 =      0x91e9ee.0p-25,	/* 0.28498786688 */
24152335SbdeLg4 =      0xf89e26.0p-26;	/* 0.24279078841 */
252116Sjkh
26216210Sdasstatic inline float
27226376Sdask_log1pf(float f)
282116Sjkh{
29226376Sdas	float hfsq,s,z,R,w,t1,t2;
302116Sjkh
318870Srgrimes 	s = f/((float)2.0+f);
322116Sjkh	z = s*s;
332116Sjkh	w = z*z;
34152335Sbde	t1= w*(Lg2+w*Lg4);
35152335Sbde	t2= z*(Lg1+w*Lg3);
362116Sjkh	R = t2+t1;
37226376Sdas	hfsq=(float)0.5*f*f;
38226376Sdas	return s*(hfsq+R);
392116Sjkh}
40