diff options
author | dos-reis <gdr@axiomatics.org> | 2007-12-08 22:40:56 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2007-12-08 22:40:56 +0000 |
commit | ec1632426a56a5ba9771ed31abfd747510b185b9 (patch) | |
tree | fec95e535cbeb549e6cbc171a740df5b9bb3ddfb /src/lib | |
parent | 8bd29deee2d75510dc62408582ac8449df93a166 (diff) | |
download | open-axiom-ec1632426a56a5ba9771ed31abfd747510b185b9.tar.gz |
* sockio-c.c: Include <math.h>
(plus_infinity): Use INFINITY if available.
(minus_infinity): Use plus_infinity().
(NANQ): Use NAN if available.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/ChangeLog | 7 | ||||
-rw-r--r-- | src/lib/sockio-c.c | 22 |
2 files changed, 23 insertions, 6 deletions
diff --git a/src/lib/ChangeLog b/src/lib/ChangeLog index a77f2c17..3d78f5f1 100644 --- a/src/lib/ChangeLog +++ b/src/lib/ChangeLog @@ -1,3 +1,10 @@ +2007-12-08 Gabriel Dos Reis <gdr@cs.tamu.edu> + + * sockio-c.c: Include <math.h> + (plus_infinity): Use INFINITY if available. + (minus_infinity): Use plus_infinity(). + (NANQ): Use NAN if available. + 2007-12-04 Gabriel Dos Reis <gdr@cs.tamu.edu> * sockio-c.c (plus_infinity): Use GCC builtin. diff --git a/src/lib/sockio-c.c b/src/lib/sockio-c.c index 718276b1..31c849bb 100644 --- a/src/lib/sockio-c.c +++ b/src/lib/sockio-c.c @@ -48,6 +48,9 @@ #include <string.h> #include <signal.h> +#define _ISOC99_SOURCE +#include <math.h> + #include "com.h" #include "bsdsignal.h" @@ -1149,23 +1152,30 @@ print_line(char *s) } -/* The next three functions use GCC extensions. At the moment, that - is not a problem because GCC is a requirement. */ - double plus_infinity(void ) { - return __builtin_huge_val(); +#ifdef INFINITY + return INFINITY; +#else + /* This must be a curious platform. */ + volatile double zero = 0.0; + return 1.0 / zero; /* If it traps, well, it traps. */ +#endif } double minus_infinity(void) { - return -__builtin_huge_val(); + return -plus_infinity(); } double NANQ(void) { - return __builtin_nan(""); +#ifdef NAN + return NAN; +#else + return sqrt(-1.0); /* Juts pick one. */ +#endif } |