chiark / gitweb /
@@@ wip
[mLib] / struct / buf-float.c
index 502b96b8ad991b2e4750259f60bac9dcfe4afa45..88d6c440a1622a21389893dcb0bb7454af6eceec 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "bits.h"
 #include "buf.h"
+#include "maths.h"
 
 /*----- Formatting primitives ---------------------------------------------*/
 
@@ -80,24 +81,6 @@ static kludge64 f64_to_k64(double x)
 
   /* Some machinery before we start. */
 
-#ifdef isnan
-#  define NANP(x) isnan(x)
-#else
-#  define NANP(x) (!((x) == (x)))
-#endif
-
-#ifdef isinf
-#  define INFP(x) isinf(x)
-#else
-#  define INFP(x) ((x) > DBL_MAX || (x) < -DBL_MAX)
-#endif
-
-#ifdef signbit
-#  define NEGP(x) signbit(x)
-#else
-#  define NEGP(x) ((x) < 0)            /* incorrect for negative zero! */
-#endif
-
   if (NANP(x)) {
     /* A NaN. */
     hi = 0x7ff80000; lo = 0;
@@ -168,10 +151,6 @@ static kludge64 f64_to_k64(double x)
 
   /* Convert to external format and go home. */
   SET64(k, hi, lo); return (k);
-
-#undef NANP
-#undef INFP
-#undef NEGP
 }
 
 /* --- @k64_to_f64@ --- *