unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* DINFINITY alpha not gnu/linux
@ 2004-02-16 22:36 Kevin Ryde
  2004-02-16 22:51 ` John W. Eaton
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2004-02-16 22:36 UTC (permalink / raw)


I see numbers.c guile_ieee_init is setup to use DINFINITY on

	defined (__alpha__) && ! defined (linux)

DINFINITY is not available on alpha freebsd.  I take it it's an
OSF-ism.  There really wants to be an autoconf probe for DINFINITY,
rather than cpp defines.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* DINFINITY alpha not gnu/linux
  2004-02-16 22:36 DINFINITY alpha not gnu/linux Kevin Ryde
@ 2004-02-16 22:51 ` John W. Eaton
  2004-02-16 23:06   ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Eaton @ 2004-02-16 22:51 UTC (permalink / raw)
  Cc: guile-devel

On 17-Feb-2004, Kevin Ryde <user42@zip.com.au> wrote:

| I see numbers.c guile_ieee_init is setup to use DINFINITY on
| 
| 	defined (__alpha__) && ! defined (linux)
| 
| DINFINITY is not available on alpha freebsd.  I take it it's an
| OSF-ism.  There really wants to be an autoconf probe for DINFINITY,
| rather than cpp defines.

I think this code is probably my fault.  I took it from Octave, which
is what I originally wrote it for.

Octave now uses

  #if defined (SCO)
	volatile double tmp = 1.0;
	tmp_inf = 1.0 / (tmp - tmp);
  #elif defined (__alpha__) && defined (__osf__)
	extern unsigned int DINFINITY[2];
	tmp_inf =  (*(X_CAST(double *, DINFINITY)));
  #else
	double tmp = 1e+10;
	tmp_inf = tmp;
	for (;;)
	  {
	    tmp_inf *= 1e+10;
	    if (tmp_inf == tmp)
	      break;
	    tmp = tmp_inf;
	  }
  #endif

to define Inf, but there may be better ways to do this.  If so, please
pass the code back to Octave as well as fixing guile.

Thanks,

jwe

-- 
www.octave.org | www.che.wisc.edu/~jwe | Peace would shock and awe me.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: DINFINITY alpha not gnu/linux
  2004-02-16 22:51 ` John W. Eaton
@ 2004-02-16 23:06   ` Kevin Ryde
  2004-02-16 23:41     ` John W. Eaton
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Ryde @ 2004-02-16 23:06 UTC (permalink / raw)
  Cc: guile-devel

"John W. Eaton" <jwe@bevo.che.wisc.edu> writes:
>
>   #if defined (SCO)
> 	volatile double tmp = 1.0;
> 	tmp_inf = 1.0 / (tmp - tmp);

This is not really sco specific is it?  I'd guess anywhere with a
working "volatile" and overflow exceptions masked would be ok.

> to define Inf, but there may be better ways to do this.

C99 INFINITY is probably good, when available.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: DINFINITY alpha not gnu/linux
  2004-02-16 23:06   ` Kevin Ryde
@ 2004-02-16 23:41     ` John W. Eaton
  2004-02-21 22:08       ` Kevin Ryde
  0 siblings, 1 reply; 5+ messages in thread
From: John W. Eaton @ 2004-02-16 23:41 UTC (permalink / raw)
  Cc: guile-devel

On 17-Feb-2004, Kevin Ryde <user42@zip.com.au> wrote:

| "John W. Eaton" <jwe@bevo.che.wisc.edu> writes:
| >
| >   #if defined (SCO)
| > 	volatile double tmp = 1.0;
| > 	tmp_inf = 1.0 / (tmp - tmp);
| 
| This is not really sco specific is it?

No.  I think it was added a long time ago to work around some problem
on SCO systems and never removed.  I'd guess it doesn't matter now.

| I'd guess anywhere with a
| working "volatile" and overflow exceptions masked would be ok.

Yes.

| > to define Inf, but there may be better ways to do this.
| 
| C99 INFINITY is probably good, when available.

OK.

Thanks,

jwe

-- 
www.octave.org | www.che.wisc.edu/~jwe | Peace would shock and awe me.


_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


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

* Re: DINFINITY alpha not gnu/linux
  2004-02-16 23:41     ` John W. Eaton
@ 2004-02-21 22:08       ` Kevin Ryde
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Ryde @ 2004-02-21 22:08 UTC (permalink / raw)
  Cc: guile-devel

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

I'm looking at

        * numbers.c (guile_ieee_init): Use C99 INFINITY and NAN when
        available.  Test HAVE_DINFINITY and HAVE_DQNAN for those globals, in
        particular don't assume "defined (__alpha__) && ! defined (linux)"
        means OSF.  Remove "SCO" code, which was not really SCO specific and
        which John W. Eaton advises should be long past being needed.


[-- Attachment #2: numbers.c.inf.diff --]
[-- Type: text/plain, Size: 1135 bytes --]

--- numbers.c.~1.223.~	2004-02-21 14:02:45.000000000 +1000
+++ numbers.c	2004-02-22 08:02:53.000000000 +1000
@@ -560,10 +560,15 @@
 /* Some version of gcc on some old version of Linux used to crash when
    trying to make Inf and NaN.  */
 
-#if defined (SCO)
-  double tmp = 1.0;
-  guile_Inf = 1.0 / (tmp - tmp);
-#elif defined (__alpha__) && ! defined (linux)
+#ifdef INFINITY
+  /* C99 INFINITY, when available.
+     FIXME: The standard allows for INFINITY to be something that overflows
+     at compile time.  We ought to have a configure test to check for that
+     before trying to use it.  (But in practice we believe this is not a
+     problem on any system guile is likely to target.)  */
+  guile_Inf = INFINITY;
+#elif HAVE_DINFINITY
+  /* OSF */
   extern unsigned int DINFINITY[2];
   guile_Inf = (*(X_CAST(double *, DINFINITY)));
 #else
@@ -582,7 +587,11 @@
 
 #if defined (HAVE_ISNAN)
 
-#if defined (__alpha__) && ! defined (linux)
+#ifdef NAN
+  /* C99 NAN, when available */
+  guile_NaN = NAN;
+#elif HAVE_DQNAN
+  /* OSF */
   extern unsigned int DQNAN[2];
   guile_NaN =  (*(X_CAST(double *, DQNAN)));
 #else

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

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

end of thread, other threads:[~2004-02-21 22:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-16 22:36 DINFINITY alpha not gnu/linux Kevin Ryde
2004-02-16 22:51 ` John W. Eaton
2004-02-16 23:06   ` Kevin Ryde
2004-02-16 23:41     ` John W. Eaton
2004-02-21 22:08       ` Kevin Ryde

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).