This is the mail archive of the gsl-discuss@sourceware.org mailing list for the GSL 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]

Re: test release gsl-1.9.90.tar.gz



On 13 sep 2007, at 10.03, Aleksej Saushev wrote:


Tommy Nordgren <tommy.nordgren@comhem.se> writes:

FAIL: gsl_isinf(-inf) (1 observed vs -1 expected) [112]
FAIL: test

	The following alternate patch will fix the test failure,
without  modifying the test cases.
--- /Users/emac/Desktop/infnan.c        2007-09-12
22:37:19.000000000  +0200
+++ /Softsys/gsl-1.9.90/sys/infnan.c    2007-09-12
22:44:30.000000000  +0200
@@ -118,7 +118,11 @@
 int
 gsl_isinf (const double x)
 {
-    return isinf(x);
+       int result = isinf(x);
+       if (result > 0 && x < 0) {
+               result = - result;
+       }
+       return result;
 }
 # else
Note: the one on the desktop is the unmodified file.
Also, with make -k check all other test cases pass.

As for me, I don't like the proposal.


It is clear, that the test case is wrong, since in C truth is
denoted by "1", and not by "-1".  This is more convenient from
scientist's point of view too.

If you really want to fix test code, you'd better make it deal
with standard semantic:

   The isinf() macro returns a non-zero value if the value of x
   is an infinity.  Otherwise 0 is returned.

Obviously, test code doesn't behave well, when isinf returns
12345 as its value.
It's still necessary to fix 'isfnan.c' somewhere though. There are two alternative
conditionally compiled versions of gsl_isinf.
Here is an alternate fix, that will pass your updated test case, when isinf is not defined on the system.
--- /Users/emac/Desktop/infnan.c 2007-09-13 11:33:25.000000000 +0200
+++ /Softsys/gsl-1.9.90/sys/infnan.c 2007-09-13 11:34:57.000000000 +0200
@@ -127,7 +127,7 @@
{
if (! gsl_finite(x) && ! gsl_isnan(x))
{
- return (x > 0 ? +1 : -1);
+ return 1;
}
else
{


------
What is a woman that you forsake her, and the hearth fire and the home acre,
to go with the old grey Widow Maker. --Kipling, harp song of the Dane women
Tommy Nordgren
tommy.nordgren@comhem.se





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