public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* gsl_isnan in eigen/*.c for 1.3
@ 2003-01-01 20:54 Albert Chin
  2003-01-01 21:33 ` Brian Gough
  0 siblings, 1 reply; 3+ messages in thread
From: Albert Chin @ 2003-01-01 20:54 UTC (permalink / raw)
  To: gsl-discuss

Why do eigen/symm.c, eigen/symmv.c, eigen/herm.c, and eigen/hermv.c
use gsl_isnan() rather than isnan()? gsl_isnan is defined only when
using Microsoft Visual C++ (sys/infnan.c) or if HAVE_IEEE_COMPARISONS
is defined. On HP-UX 10.20, HAVE_IEEE_COMPARISONS is not defined. As
isnan is defined to gsl_isnan in config.h, why not use isnan()?

Is it really bad for HP-UX 10.20 to fail the HAVE_IEEE_COMPARISONS
test?

Ditto for sys/test.c.

-- 
albert chin (china@thewrittenword.com)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_isnan in eigen/*.c for 1.3
  2003-01-01 20:54 gsl_isnan in eigen/*.c for 1.3 Albert Chin
@ 2003-01-01 21:33 ` Brian Gough
  2003-01-02 18:04   ` Albert Chin
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Gough @ 2003-01-01 21:33 UTC (permalink / raw)
  To: gsl-discuss

Albert Chin writes:
 > Why do eigen/symm.c, eigen/symmv.c, eigen/herm.c, and eigen/hermv.c
 > use gsl_isnan() rather than isnan()? gsl_isnan is defined only when
 > using Microsoft Visual C++ (sys/infnan.c) or if HAVE_IEEE_COMPARISONS
 > is defined. On HP-UX 10.20, HAVE_IEEE_COMPARISONS is not defined. As
 > isnan is defined to gsl_isnan in config.h, why not use isnan()?
 > 
 > Is it really bad for HP-UX 10.20 to fail the HAVE_IEEE_COMPARISONS
 > test?
 > 
 > Ditto for sys/test.c.

It was a bug. The library should use isnan, etc internally, and have
them replaced by gsl_isnan through config.h.  If isnan is available
and IEEE comparisons aren't then gsl_isnan should be defined in terms
of isnan.  Try this patch (untested).


Index: eigen/herm.c
===================================================================
RCS file: /cvs/gsl/gsl/eigen/herm.c,v
retrieving revision 1.5
diff -u -r1.5 herm.c
--- eigen/herm.c	16 Nov 2002 17:57:34 -0000	1.5
+++ eigen/herm.c	1 Jan 2003 21:24:53 -0000
@@ -133,7 +133,7 @@
       
       while (b > 0)
         {
-          if (sd[b - 1] == 0.0 || gsl_isnan(sd[b - 1]))
+          if (sd[b - 1] == 0.0 || isnan(sd[b - 1]))
             {
               b--;
               continue;
Index: eigen/hermv.c
===================================================================
RCS file: /cvs/gsl/gsl/eigen/hermv.c,v
retrieving revision 1.6
diff -u -r1.6 hermv.c
--- eigen/hermv.c	16 Nov 2002 17:57:34 -0000	1.6
+++ eigen/hermv.c	1 Jan 2003 21:24:53 -0000
@@ -173,7 +173,7 @@
       
       while (b > 0)
         {
-          if (sd[b - 1] == 0.0 || gsl_isnan(sd[b - 1]))
+          if (sd[b - 1] == 0.0 || isnan(sd[b - 1]))
             {
               b--;
               continue;
Index: eigen/symm.c
===================================================================
RCS file: /cvs/gsl/gsl/eigen/symm.c,v
retrieving revision 1.5
diff -u -r1.5 symm.c
--- eigen/symm.c	16 Nov 2002 17:57:34 -0000	1.5
+++ eigen/symm.c	1 Jan 2003 21:24:53 -0000
@@ -133,7 +133,7 @@
       
       while (b > 0)
         {
-          if (sd[b - 1] == 0.0 || gsl_isnan(sd[b - 1]))
+          if (sd[b - 1] == 0.0 || isnan(sd[b - 1]))
             {
               b--;
               continue;
Index: eigen/symmv.c
===================================================================
RCS file: /cvs/gsl/gsl/eigen/symmv.c,v
retrieving revision 1.5
diff -u -r1.5 symmv.c
--- eigen/symmv.c	16 Nov 2002 17:57:34 -0000	1.5
+++ eigen/symmv.c	1 Jan 2003 21:24:53 -0000
@@ -150,7 +150,7 @@
       
       while (b > 0)
         {
-          if (sd[b - 1] == 0.0 || gsl_isnan(sd[b - 1]))
+          if (sd[b - 1] == 0.0 || isnan(sd[b - 1]))
             {
               b--;
               continue;
Index: sys/infnan.c
===================================================================
RCS file: /cvs/gsl/gsl/sys/infnan.c,v
retrieving revision 1.4
diff -u -r1.4 infnan.c
--- sys/infnan.c	16 Jan 2002 16:58:33 -0000	1.4
+++ sys/infnan.c	1 Jan 2003 21:24:54 -0000
@@ -100,5 +100,37 @@
   int status = (y == y);
   return status;
 }
+#else
+
+#ifdef HAVE_ISNAN
+int
+gsl_isnan (const double x)
+{
+  return isnan(x);
+}
+#endif
+
+#ifdef HAVE_ISINF
+int
+gsl_isinf (const double x)
+{
+    return isinf(x);
+}
+#endif
+
+#ifdef HAVE_FINITE
+int
+gsl_finite (const double x)
+{
+  return finite(x);
+}
+#elif defined(HAVE_ISFINITE)
+int
+gsl_finite (const double x)
+{
+  return isfinite(x);
+}
+#endif
+
 #endif
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gsl_isnan in eigen/*.c for 1.3
  2003-01-01 21:33 ` Brian Gough
@ 2003-01-02 18:04   ` Albert Chin
  0 siblings, 0 replies; 3+ messages in thread
From: Albert Chin @ 2003-01-02 18:04 UTC (permalink / raw)
  To: gsl-discuss

On Wed, Jan 01, 2003 at 09:30:28PM +0000, Brian Gough wrote:
> Albert Chin writes:
>  > Why do eigen/symm.c, eigen/symmv.c, eigen/herm.c, and eigen/hermv.c
>  > use gsl_isnan() rather than isnan()? gsl_isnan is defined only when
>  > using Microsoft Visual C++ (sys/infnan.c) or if HAVE_IEEE_COMPARISONS
>  > is defined. On HP-UX 10.20, HAVE_IEEE_COMPARISONS is not defined. As
>  > isnan is defined to gsl_isnan in config.h, why not use isnan()?
>  > 
>  > Is it really bad for HP-UX 10.20 to fail the HAVE_IEEE_COMPARISONS
>  > test?
>  > 
>  > Ditto for sys/test.c.
> 
> It was a bug. The library should use isnan, etc internally, and have
> them replaced by gsl_isnan through config.h.  If isnan is available
> and IEEE comparisons aren't then gsl_isnan should be defined in terms
> of isnan.  Try this patch (untested).

The patch works. Thanks!

-- 
albert chin (china@thewrittenword.com)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-02 18:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-01 20:54 gsl_isnan in eigen/*.c for 1.3 Albert Chin
2003-01-01 21:33 ` Brian Gough
2003-01-02 18:04   ` Albert Chin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).