[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8
From: |
Camm Maguire |
Subject: |
Re: [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8 |
Date: |
25 May 2004 22:48:27 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Greetings, and thanks! A slightly modified version is committed.
Please let me know if I've made any errors.
Take care,
Magnus Henoch <address@hidden> writes:
> Now I've written a better isnormal:
>
> --- orig/acconfig.h
> +++ mod/acconfig.h
> @@ -166,8 +166,12 @@
> #include <ieeefp.h>
> #define ISNORMAL(a) (fpclass(a)>=FP_NZERO)
> #else
> -#include <math.h>
> -#define ISNORMAL(a) (finite(a) && (a) != 0.0)
> +#define NEED_OWN_ISNORMAL
> +int gcl_isnormal_double(double d);
> +int gcl_isnormal_float(float f);
> +#define ISNORMAL(a) ((sizeof (a) == sizeof (float)) ? \
> + gcl_isnormal_float(a) : \
> + gcl_isnormal_double(a))
> #endif
> #endif
> #endif
>
>
> --- orig/o/num_co.c
> +++ mod/o/num_co.c
> @@ -29,6 +29,7 @@
> #define IN_NUM_CO
>
> #define NEED_MP_H
> +#define NEED_ISFINITE
>
> #include "include.h"
> #include "num_include.h"
> @@ -39,6 +40,63 @@
> #define VAX
> #endif
>
> +#ifdef NEED_OWN_ISNORMAL
> +/* NEED_OWN_ISNORMAL is defined when the system doesn't provide a
> + useful isnormal function.
> +
> + A number is normal when:
> + * it is finite,
> + * it is not zero, and
> + * its exponent is non-zero.
> +*/
> +int gcl_isnormal_double(double d)
> +{
> + union {double d;int i[2];} u;
> +
> + if (!ISFINITE(d))
> + return 0;
> +
> + if (d == 0.0)
> + return 0;
> +
> +#ifdef VAX
> +#error gcl_isnormal_double not implemented for VAX
> +#endif
> +#ifdef IEEEFLOAT
> + u.d = d;
> + return (u.i[HIND] & 0x7ff00000) != 0;
> +#endif
> +#ifdef S3000
> +#error gcl_isnormal_double not implemented for S3000
> +#endif
> +
> +}
> +
> +int gcl_isnormal_float(float f)
> +{
> + union {float f;int i;} u;
> +
> + if (!ISFINITE(f))
> + return 0;
> +
> + if (f == 0.0)
> + return 0;
> +
> +#ifdef VAX
> +#error gcl_isnormal_float not implemented for VAX
> +#endif
> +#ifdef IEEEFLOAT
> + u.f = f;
> + return (u.i & 0x7f800000) != 0;
> +#endif
> +#ifdef S3000
> +#error gcl_isnormal_float not implemented for S3000
> +#endif
> +
> +}
> +
> +#endif /* NEED_OWN_ISNORMAL */
> +
> #ifdef VAX
> /*
> radix = 2
>
>
>
> Testing it with your program gave identical results to glibc
> isnormal - on Debian/i386, that is; I don't have access to other
> hardware.
>
> My new functions simply bail out on VAX and S3000.
>
> Regards,
> Magnus
> _______________________________________________
> Gcl-devel mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/gcl-devel
--
Camm Maguire address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens." -- Baha'u'llah
- [Gcl-devel] Building GCL 2.6.1 on FreeBSD 4.8, Chris Hall, 2004/05/13
- Re: [Gcl-devel] Building GCL 2.6.1 on FreeBSD 4.8, Camm Maguire, 2004/05/13
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Chris Hall, 2004/05/13
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Magnus Henoch, 2004/05/14
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Chris Hall, 2004/05/14
- Re: [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Camm Maguire, 2004/05/18
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Magnus Henoch, 2004/05/18
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Magnus Henoch, 2004/05/25
- Re: [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8,
Camm Maguire <=
- [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Magnus Henoch, 2004/05/27
- Re: [Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Camm Maguire, 2004/05/27
[Gcl-devel] Re: Building GCL 2.6.1 on FreeBSD 4.8, Chris Hall, 2004/05/15