delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/01/18/13:02:38

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <200301181746.h0IHkRf21623@brother.ludd.luth.se>
Subject: math function verification
To: djgpp-workers AT delorie DOT com (DJGPP-WORKERS)
Date: Sat, 18 Jan 2003 18:46:27 +0100 (MET)
X-Mailer: ELM [version 2.5 PL2]
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

Hello.

I've been looking for C99 math function verifation code. The advices
so far is:

1. Check glibc. I haven't yet.

2. Four (or seven, but I haven't messed with it) is available at
<ftp://jump.net/pub/tybor/>. (Get the "readme.1st" file.) It's some
examples from a thorough test suite that costs money, i. e. to make
you go and buy it. But hey!, four test cases for free.

Two of the tests are for C99 (tflt2int and tint2flt) which I haven't
tried as they require fenv.h (I haven't applied our C99 patch).

However the other two (tsin and tbin2dec) are for C89, and they claim
we have errors...

tsin is "Test of sin(355.0)" and tbin2dec is "Test of printf() of
binary to decimal conversions of double.".

tsin compile with -lm is ok.

tsin without -lm gives (perhaps that is to be expected as its supposed
to be fast instead of correct to the last bit)):
sin(355) = -3.01443533594889079e-05 from math library.
sin(355) = -3.01443533594884505e-05 is correct answer.
About 7.09 bits are wrong out of 53.00 total bits.
That is about 135.00 ULPs (Units Last Place) bits error.

tbin2dec compiled (with or without -lm) gives:
FAIL: dig=40, errno=0, rc=42, kk=7
, %e=>9.400000000000014508012846636830772695248e-40000000000000000000000000000000000000000000000000000000000000
, %f=>0.0...010 (... is 36 0s)
, %f[41] should be 9 (based upon %e)
FAIL: dig=40, errno=0, rc=42, kk=6
, %e=>9.400000000000012874770694004666893306421e-40000000000000000000000000000000000000000000000000000000000000
, %f=>0.0...010 (... is 36 0s)
, %f[41] should be 9 (based upon %e)
FAIL: dig=40, errno=0, rc=42, kk=5
, %e=>9.400000000000011241528541372503013917594e-40000000000000000000000000000000000000000000000000000000000000
, %f=>0.0...010 (... is 36 0s)
, %f[41] should be 9 (based upon %e)
FAIL: dig=40, errno=0, rc=42, kk=4
, %e=>9.400000000000009612623197430281152264797e-40000000000000000000000000000000000000000000000000000000000000
, %f=>0.0...010 (... is 36 0s)
, %f[41] should be 9 (based upon %e)
FAIL: dig=40, errno=0, rc=42, kk=3
, %e=>9.400000000000007981115768274094079970382e-40000000000000000000000000000000000000000000000000000000000000
, %f=>0.0...010 (... is 36 0s)
, %f[41] should be 9 (based upon %e)
WARNING:  Not all 67536 failures were printed.
  2 failures were due to %e producing x.50...0e-nn
  Rounding is round to nearest, even.


Right,

						MartinS

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019