some float.h updates

Richard Henderson rth@twiddle.net
Wed Jan 31 12:28:00 GMT 2001


This takes care of the bulk of the cases. 

The normal case for FLT_EVAL_METHOD is 0 (evaluate to range and precision
of the type).  I don't know of any machines except for i386 and m68k that
don't do this, but I also know that I don't know the intimate details of
most of the old fpus.

So if you've got an old processor that you love for which FLT_EVAL_METHOD
should be other than zero, and which does not already have its own float.h,
let me know and we'll figure out what needs doing to correct this.

I've not fixed up m68k because we need specs changes to be able to tell
if TARGET_68040_ONLY is in effect.  I've not fixed up c4x or vax because
I don't know how their fpus work.



r~


        * config/float-i128.h (FLT_EVAL_METHOD, DECIMAL_DIG): Define.
        * config/float-i32.h: Likewise.
        * config/float-i64.h: Likewise.
        * config/float-sh.h: Likewise.
        * config/float-sparc.h: Likewise.

Index: float-i128.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-i128.h,v
retrieving revision 1.2
diff -u -p -r1.2 float-i128.h
--- float-i128.h	1998/12/16 20:59:42	1.2
+++ float-i128.h	2001/01/31 18:02:13
@@ -93,4 +93,31 @@
 #undef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP 4932
 
+#if __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# define DECIMAL_DIG	36
+
+#endif	/* C99 */
+
 #endif /*  _FLOAT_H_ */
Index: float-i32.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-i32.h,v
retrieving revision 1.2
diff -u -p -r1.2 float-i32.h
--- float-i32.h	1998/12/16 20:59:43	1.2
+++ float-i32.h	2001/01/31 18:02:13
@@ -93,4 +93,31 @@
 #undef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP 38
 
+#if __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# define DECIMAL_DIG	9
+
+#endif	/* C99 */
+
 #endif /*  _FLOAT_H_ */
Index: float-i64.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-i64.h,v
retrieving revision 1.2
diff -u -p -r1.2 float-i64.h
--- float-i64.h	1998/12/16 20:59:45	1.2
+++ float-i64.h	2001/01/31 18:02:13
@@ -93,4 +93,31 @@
 #undef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP 308
 
+#if __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# define DECIMAL_DIG	17
+
+#endif	/* C99 */
+
 #endif /*  _FLOAT_H_ */
Index: float-m68k.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-m68k.h,v
retrieving revision 1.2
diff -u -p -r1.2 float-m68k.h
--- float-m68k.h	1998/12/16 20:59:46	1.2
+++ float-m68k.h	2001/01/31 18:02:13
@@ -94,4 +94,7 @@
 #undef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP 4932
 
+/* ??? FLT_EVAL_METHOD depends on TARGET_68040_ONLY.  We do not currently
+   have a preprocessor token that we can use to tell that this is on.  */
+
 #endif /*  _FLOAT_H_ */
Index: float-sh.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-sh.h,v
retrieving revision 1.3
diff -u -p -r1.3 float-sh.h
--- float-sh.h	1998/12/16 20:59:47	1.3
+++ float-sh.h	2001/01/31 18:02:13
@@ -127,4 +127,31 @@
 #undef LDBL_MAX_10_EXP
 #define LDBL_MAX_10_EXP 308
 
+#if __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# define DECIMAL_DIG	17
+
+#endif	/* C99 */
+
 #endif /*  _FLOAT_H_ */
Index: float-sparc.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/float-sparc.h,v
retrieving revision 1.3
diff -u -p -r1.3 float-sparc.h
--- float-sparc.h	1999/12/14 12:53:39	1.3
+++ float-sparc.h	2001/01/31 18:02:13
@@ -119,4 +119,35 @@
 
 #endif /* sparc32 */
 
+#if __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+# undef FLT_EVAL_METHOD
+# define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+# undef DECIMAL_DIG
+# if LDBL_MANT_DIG == 53
+#  define DECIMAL_DIG	17
+# else
+#  define DECIMAL_DIG	36
+# endif
+
+#endif	/* C99 */
+
 #endif /*  _FLOAT_H_ */


More information about the Gcc-patches mailing list