float_t and double_t (C99)
Hasso Tepper
hasso at estpak.ee
Mon Apr 7 13:15:13 PDT 2008
OK, second attempt attached. Obtained-from: FreeBSD with minor
modifications.
--
Hasso Tepper
diff --git a/sys/cpu/amd64/include/float.h b/sys/cpu/amd64/include/float.h
--- a/sys/cpu/amd64/include/float.h
+++ b/sys/cpu/amd64/include/float.h
@@ -40,8 +40,10 @@
#define FLT_RADIX 2 /* b */
#define FLT_ROUNDS 1 /* FP addition rounds to nearest */
-#define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */
+#if __ISO_C_VISIBLE >= 1999
+#define FLT_EVAL_METHOD 0 /* no promotions */
#define DECIMAL_DIG 21 /* max precision in decimal digits */
+#endif
#define FLT_MANT_DIG 24 /* p */
#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
diff --git a/sys/cpu/amd64/include/math.h b/sys/cpu/amd64/include/math.h
--- a/sys/cpu/amd64/include/math.h
+++ b/sys/cpu/amd64/include/math.h
@@ -9,4 +9,10 @@
#define __HAVE_LONG_DOUBLE
#define __HAVE_NANF
+#if __ISO_C_VISIBLE >= 1999
+/* 7.12#2 float_t, double_t */
+typedef float float_t;
+typedef double double_t;
#endif
+
+#endif
diff --git a/sys/cpu/i386/include/float.h b/sys/cpu/i386/include/float.h
--- a/sys/cpu/i386/include/float.h
+++ b/sys/cpu/i386/include/float.h
@@ -40,6 +40,10 @@
#define FLT_RADIX 2 /* b */
#define FLT_ROUNDS 1 /* FP addition rounds to nearest */
+#if __ISO_C_VISIBLE >= 1999
+#define FLT_EVAL_METHOD (-1) /* i387 semantics are...interesting */
+#define DECIMAL_DIG 21 /* max precision in decimal digits */
+#endif
#define FLT_MANT_DIG 24 /* p */
#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */
diff --git a/sys/cpu/i386/include/math.h b/sys/cpu/i386/include/math.h
--- a/sys/cpu/i386/include/math.h
+++ b/sys/cpu/i386/include/math.h
@@ -9,4 +9,10 @@
#define __HAVE_LONG_DOUBLE
#define __HAVE_NANF
+#if __ISO_C_VISIBLE >= 1999
+/* 7.12#2 float_t, double_t */
+typedef long double float_t;
+typedef long double double_t;
#endif
+
+#endif
More information about the Submit
mailing list