Hi, On Wed, Apr 16, 2014 at 11:50 AM, Kai Tietz <ktiet...@googlemail.com> wrote: > Hello Matthew, > > 2014-04-16 20:36 GMT+02:00 Matthew Brett <matthew.br...@gmail.com>: >> Hi, >> >> Sorry for my ignorance about mingw-w64 - I am hoping for advice on >> submitting a patch. >> >> When testing against the Python numpy library, we found a failing test >> for the mingw-w64 expm1 routine. Specifically, we found that: >> >> double i = -0.0; >> return expm1(i); >> >> returns 0 instead of -0, as I believe the standard requires: >> >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/expm1.html >> http://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00029.html >> https://github.com/gagern/gnulib/blob/master/tests/test-expm1-ieee.h > > So thanks for showing to us this bug. Math tests are a bit wacky in > general. I use normally netbsd test for validation. Nevertheless > this works only in some aspects for Windows, so we have some > additional tests in our crt's testcases directory. > > At this place I would think your testcase should go. > >> The following patch fixes this: >> >> diff -r -u mingw-w64-v3.1.0/mingw-w64-crt/math/expm1.def.h >> b/mingw-w64-crt/math/expm1.def.h >> --- mingw-w64-v3.1.0/mingw-w64-crt/math/expm1.def.h 2014-04-14 >> 20:41:33.000000000 -0700 >> +++ b/mingw-w64-crt/math/expm1.def.h 2011-04-02 09:58:41.000000000 -0700 >> @@ -60,7 +60,7 @@ >> } >> else if (x_class == FP_ZERO) >> { >> - return __FLT_CST(0.0); >> + return (signbit (x) ? -__FLT_CST(0.0) : __FLT_CST(0.0) > > Hmm, as x is in that case zero, wouldn't it be better just to return x here?
Ah - yes - that is better, thanks. >> } >> if (__FLT_ABI (fabs) (x) < __FLT_LOGE2) >> { >> >> but I don't know how to submit tests for the change. What do y'all advise? >> >> Thanks a lot, > > > A test checking exactly this case (or the set of cases for expm1) is welcome. > > Please also provide an ChangeLog entry, so we can prominent mark your > code-donation. OK, I have attached a patch - with apologies for my rusty C macro skills. Thanks a lot, Matthew
expm1_minus_zero.patch
Description: Binary data
------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public