**Subject:** CVS commit: src/lib/libm/arch/i387

**To:** None *<source-changes@NetBSD.org>*

**From:** Lex Wennmacher *<wennmach@netbsd.org>*

**List:** source-changes

**Date:** 09/10/2003 16:45:43
Module Name: src
Committed By: wennmach
Date: Wed Sep 10 16:45:43 UTC 2003
Modified Files:
src/lib/libm/arch/i387: s_log1p.S s_log1pf.S
Log Message:
Reimplement s_log1p.S and s_log1pf.S to use the fyl2xp1 instruction
where necessary.
The log1p() function is provided to compute an accurate value of
log(1 + x), even for tiny values of x. The i387 FPU provides the
fyl2xp1 instruction for this purpose.
However, since the range of the fyl2xp1 function is limited to
-(1 - (sqrt(2) / 2)) <= x <= sqrt(2) - 1
(-0.292893 <= x <= 0.414214)
we need to check if the argument is in the valid range.
In order to reduce the cost for testing the range, we only use
fyl2xp1 if the argument is in the range
-0.25 <= x <= 0.25
which can be checked with just one conditional branch.
Fixes PR lib/22599 by Ray Brownrigg.
To generate a diff of this commit:
cvs rdiff -r1.10 -r1.11 src/lib/libm/arch/i387/s_log1p.S
cvs rdiff -r1.7 -r1.8 src/lib/libm/arch/i387/s_log1pf.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.