This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RFC: libm-test.inc with more accurate values



I'm appending a first patch for libm-test that uses as input parameter
values that can be represented exactly in floats, e.g. 0.75 instead of
0.7 and use now 36 digits of output to be on the safe side even for
128 bit long doubles.

What do you think?  Shall I continue this way?

Andreas

============================================================
Index: math/libm-test.inc
--- math/libm-test.inc	2001/10/18 11:45:22	1.42
+++ math/libm-test.inc	2001/12/06 14:38:06
@@ -1,6 +1,6 @@
 /* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1997.
+   Contributed by Andreas Jaeger <aj@suse.de>, 1997.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -107,8 +107,9 @@
 
 
    To Do: All parameter should be numbers that can be represented as
-   exact floating point values.  Currently some values cannot be represented
-   exactly and therefore the result is not the expected result.
+   exact floating point values.  Currently some values cannot be
+   represented exactly and therefore the result is not the expected
+   result.  For this we will use 36 digits so that numbers can be represented exact.
 */
 
 #ifndef _GNU_SOURCE
@@ -723,8 +724,8 @@ acos_test (void)
   TEST_f_f (acos, nan_value, nan_value);
 
   /* |x| > 1: */
-  TEST_f_f (acos, 1.1L, nan_value, INVALID_EXCEPTION);
-  TEST_f_f (acos, -1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acos, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acos, -1.125L, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (acos, 0, M_PI_2l);
   TEST_f_f (acos, minus_zero, M_PI_2l);
@@ -732,8 +733,9 @@ acos_test (void)
   TEST_f_f (acos, -1, M_PIl);
   TEST_f_f (acos, 0.5, M_PI_6l*2.0);
   TEST_f_f (acos, -0.5, M_PI_6l*4.0);
-  TEST_f_f (acos, 0.7L, 0.79539883018414355549096833892476432L);
-
+  TEST_f_f (acos, 0.75L, 0.722734247813415611178377352641333362L);
+  TEST_f_f (acos, 2e-17L, 1.57079632679489659923132169163975144L);
+  TEST_f_f (acos, 0.0625L, 1.50825556499840522843072005474337068);
   END (acos);
 }
 
@@ -752,10 +754,10 @@ acosh_test (void)
   TEST_f_f (acosh, minus_infty, nan_value, INVALID_EXCEPTION);
 
   /* x < 1:  */
-  TEST_f_f (acosh, -1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (acosh, -1.125L, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (acosh, 1, 0);
-  TEST_f_f (acosh, 7, 2.633915793849633417250092694615937L);
+  TEST_f_f (acosh, 7, 2.63391579384963341725009269461593689L);
 
   END (acosh);
 }
@@ -776,8 +778,8 @@ asin_test (void)
   TEST_f_f (asin, nan_value, nan_value);
 
   /* asin x == NaN plus invalid exception for |x| > 1.  */
-  TEST_f_f (asin, 1.1L, nan_value, INVALID_EXCEPTION);
-  TEST_f_f (asin, -1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (asin, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (asin, -1.125L, nan_value, INVALID_EXCEPTION);
 
   TEST_f_f (asin, 0, 0);
   TEST_f_f (asin, minus_zero, minus_zero);
@@ -785,7 +787,7 @@ asin_test (void)
   TEST_f_f (asin, -0.5, -M_PI_6l);
   TEST_f_f (asin, 1.0, M_PI_2l);
   TEST_f_f (asin, -1.0, -M_PI_2l);
-  TEST_f_f (asin, 0.7L, 0.77539749661075306374035335271498708L);
+  TEST_f_f (asin, 0.75L, 0.848062078981481008052944338998418080L);
 
   END (asin);
 }
@@ -808,7 +810,7 @@ asinh_test (void)
   TEST_f_f (asinh, minus_infty, minus_infty);
 #endif
   TEST_f_f (asinh, nan_value, nan_value);
-  TEST_f_f (asinh, 0.7L, 0.652666566082355786L);
+  TEST_f_f (asinh, 0.75L, 0.693147180559945309417232121458176568L);
 
   END (asinh);
 }
@@ -834,7 +836,7 @@ atan_test (void)
   TEST_f_f (atan, 1, M_PI_4l);
   TEST_f_f (atan, -1, -M_PI_4l);
 
-  TEST_f_f (atan, 0.7L, 0.61072596438920861654375887649023613L);
+  TEST_f_f (atan, 0.75L, 0.643501108793284386802809228717322638L);
 
   END (atan);
 }
@@ -861,10 +863,10 @@ atanh_test (void)
   TEST_f_f (atanh, nan_value, nan_value);
 
   /* atanh (x) == NaN plus invalid exception if |x| > 1.  */
-  TEST_f_f (atanh, 1.1L, nan_value, INVALID_EXCEPTION);
-  TEST_f_f (atanh, -1.1L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (atanh, 1.125L, nan_value, INVALID_EXCEPTION);
+  TEST_f_f (atanh, -1.125L, nan_value, INVALID_EXCEPTION);
 
-  TEST_f_f (atanh, 0.7L, 0.8673005276940531944L);
+  TEST_f_f (atanh, 0.75L, 0.972955074527656652552676371721589865L);
 
   END (atanh);
 }
@@ -934,16 +936,17 @@ atan2_test (void)
   TEST_ff_f (atan2, minus_infty, minus_infty, -M_PI_34l);
   TEST_ff_f (atan2, nan_value, nan_value, nan_value);
 
-  TEST_ff_f (atan2, 0.7L, 1, 0.61072596438920861654375887649023613L);
-  TEST_ff_f (atan2, -0.7L, 1.0L, -0.61072596438920861654375887649023613L);
-  TEST_ff_f (atan2, 0.7L, -1.0L, 2.530866689200584621918884506789267L);
-  TEST_ff_f (atan2, -0.7L, -1.0L, -2.530866689200584621918884506789267L);
-  TEST_ff_f (atan2, 0.4L, 0.0003L, 1.5700463269355215717704032607580829L);
-  TEST_ff_f (atan2, 1.4L, -0.93L, 2.1571487668237843754887415992772736L);
+  TEST_ff_f (atan2, 0.75L, 1, 0.643501108793284386802809228717322638L);
+  TEST_ff_f (atan2, -0.75L, 1.0L, -0.643501108793284386802809228717322638L);
+  TEST_ff_f (atan2, 0.75L, -1.0L, 2.49809154479650885165983415456218025L);
+  TEST_ff_f (atan2, -0.75L, -1.0L, -2.49809154479650885165983415456218025L);
+  TEST_ff_f (atan2, 0.390625L, .00029L, 1.57005392693128974780151246612928941L);
+  TEST_ff_f (atan2, 1.390625L, 0.9296875L, 0.981498387184244311516296577615519772L);
 
   END (atan2);
 }
 
+// XXX Continue here...
 
 static void
 cabs_test (void)


-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]