From 957e491bbab90e2c8572a383962bc2a180944226 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 23 Sep 2003 12:16:22 +0000 Subject: [PATCH] * Use DBL_MAX instead of HUGE_VAL for float precision when available. git-svn-id: svn://svn.zoy.org/elk/trunk@179 55e467fa-43c5-0310-a8a2-de718669efc6 --- include/site.h.in | 4 ---- src/bignum.c | 10 +++++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/site.h.in b/include/site.h.in index c52f924..0ea0418 100644 --- a/include/site.h.in +++ b/include/site.h.in @@ -36,10 +36,6 @@ # define __asm__ asm #endif -#ifndef HUGE -# define HUGE HUGE_VAL -#endif - /* Under gcc, we use the __attribute__ macro to tell the compiler that a * function does not return. */ #ifdef __GNUC__ diff --git a/src/bignum.c b/src/bignum.c index de7f24e..a1ff19e 100644 --- a/src/bignum.c +++ b/src/bignum.c @@ -36,6 +36,14 @@ #include "kernel.h" +#ifndef DBL_MAX +# ifdef HUGE_VAL +# define DBL_MAX HUGE_VAL +# else +# define DBL_MAX (3.40282e+38) +# endif +#endif + static void Bignum_Mult_In_Place (register struct S_Bignum *, int); static void Bignum_Add_In_Place (register struct S_Bignum *, int); static int Bignum_Div_In_Place (register struct S_Bignum *, int); @@ -440,7 +448,7 @@ double Bignum_To_Double (Object x) { /* error if it ain't fit */ register gran_t *p = BIGNUM(x)->data + i; for (i = BIGNUM(x)->usize; --i >= 0; ) { - if (rx >= HUGE / 65536.0) + if (rx >= DBL_MAX / 65536.0) Primitive_Error ("cannot coerce to real: ~s", x); rx *= 65536.0; rx += *--p;