From 557ea04ce0e505c98d4b6852b194d7ed06fe8289 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 1 Sep 2003 15:00:54 +0000 Subject: Atsushi Nemoto writes: I found math fpclassify function is broken because FP_XXX definitions in libm/fp_private.h is incompatible with include/math.h. Also I noticed fp_private.h and fpmacros.c use many 'long int' for 32bit variables. I think these should be int or u_int32_t. Here is a patch against 0.9.20. fp_private.c: --- fix union members (use u_int32_t instead of 'unsigned long int'). --- remove incompatible FP_XXX definitions (and some unused macros). fpmacros.c: --- use FP_NAN instead of FP_QNAN/FP_SNAN. --- use correct type (int instead of long int). --- fix union members (use u_int32_t instead of 'unsigned long int'). --- remove unnecessary cast. Note that I had to remove weak_alias for isnanl,isinfl to compile patched fpmacroc.c. Is this really needed? Original behavior (using isnan for isnanl) seems problematic anyway. --- libm/fp_private.h | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'libm/fp_private.h') diff --git a/libm/fp_private.h b/libm/fp_private.h index 30b3e0572..97b3b5703 100644 --- a/libm/fp_private.h +++ b/libm/fp_private.h @@ -72,11 +72,11 @@ typedef struct /* Hex representation of a double. */ { #if defined(__BIG_ENDIAN__) - unsigned long int high; - unsigned long int low; + u_int32_t high; + u_int32_t low; #else - unsigned long int low; - unsigned long int high; + u_int32_t low; + u_int32_t high; #endif } dHexParts; @@ -85,28 +85,3 @@ typedef union unsigned char byties[8]; double dbl; } DblInHex; - -//enum boolean { FALSE, TRUE }; - -/******************************************************************************* -* Macros to access long subfields of a double value. * -*******************************************************************************/ - -#define highpartd(x) *((long *) &x) -#define lowpartd(x) *((long *) &x + 1) - -enum { - FP_SNAN = 0, /* signaling NaN - */ - FP_QNAN = 1, /* quiet NaN - */ - FP_INFINITE = 2, /* + or - infinity - */ - FP_ZERO = 3, /* + or - zero - */ - FP_NORMAL = 4, /* all normal numbers - */ - FP_SUBNORMAL = 5 /* denormal numbers - */ -}; - -- cgit v1.2.3