[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/49240: Some corner cases for pow() fail to work correctly
The following reply was made to PR lib/49240; it has been noted by GNATS.
From: Havard Eidnes <he%NetBSD.org@localhost>
Subject: Re: lib/49240: Some corner cases for pow() fail to work correctly
Date: Tue, 30 Sep 2014 14:20:55 +0200 (CEST)
I've dug some more, and it looks like the following four tests:
assertEquals(NaN, pow(1, Infinity));
assertEquals(NaN, pow(1, -Infinity));
assertEquals(NaN, pow(-1, Infinity));
assertEquals(NaN, pow(-1, -Infinity));
are in fact erroneous, at least reportedly if one is to follow
C99, and some (FreeBSD commit messages) claim the revised IEEE
754 of 2008. These are now all defined to give +1.0 as result.
I'll follow that up with Google's V8 project.
It seems our libm is based on fdlibm, but we have no entry in
doc/3RDPARTY documentind that, so "which version" is unknown to
me so far.
Interestingly, the test when run on FreeBSD 10/amd64 failed only
the four above tests, with results which were according to C99,
FreeBSD diff for the C99 update:
A pointer to fdlibm 5.3 and an IEEE test suite from UCB (I've not
looked at that yet -- will do time permitting) can be found at
There appears to be another bug in fdlibm 5.3's pow function,
talked about here:
but unfortunately the URL pointer to the fix is dead. That
document also says that the 4 above tests should give +1.0 in C99.
A minor tweak and copying of our math-private.h makes the FreeBSD
version build outside of the NetBSD source tree, and by using the
result and correcting the test cases for the above 4, I now have
a "0 fails" testrun on NetBSD.
I'll work out a minimal diff for our e_pow.c.
Main Index |
Thread Index |