DragonFly submit List (threaded) for 2008-04
DragonFly BSD
DragonFly submit List (threaded) for 2008-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

float_t and double_t (C99)


From: Hasso Tepper <hasso@xxxxxxxxx>
Date: Mon, 7 Apr 2008 14:02:55 +0300

We don't have float_t and double_t typedefs required by C99 in math.h. As 
my knowledge about all consequences are limited, I'd take safest path for 
now and would commit this patch (btw, OpenBSD has the same code for now):

diff --git a/include/math.h b/include/math.h
--- a/include/math.h
+++ b/include/math.h
@@ -77,6 +77,11 @@
  * ISO C99
  */
 #if __ISO_C_VISIBLE >= 1999
+/* 7.12#2 double_t, float_t XXX */
+typedef float	float_t;
+typedef double	double_t;
+#define	FLT_EVAL_METHOD (-1)
+
 /* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
 extern const union __float_u __infinityf;
 #ifdef __MATH_BUILTIN_CONSTANTS

Making this change in math.h is maybe wrong as well (cpu/types.h?). For 
all not familiar with what standards says:

==========================================================================
2 The types
          float_t
          double_t
  are floating types at least as wide as float and double, respectively,  
  and such that double_t is at least as wide as float_t. If 
  FLT_EVAL_METHOD equals 0, float_t and double_t are float and double, 
  respectively; if FLT_EVAL_METHOD equals 1, they are both double; if 
  FLT_EVAL_METHOD equals 2, they are both long double; and for other 
  values of FLT_EVAL_METHOD, they are otherwise implementation-defined.

  The types float_t and double_t are intended to be the implementation’s 
  most efficient types at least as wide as float and double, respectively. 
  For FLT_EVAL_METHOD equal 0, 1, or 2, the type float_t is the narrowest 
  type used by the implementation to evaluate floating expressions.
==========================================================================

FreeBSD changed both to long double recently, but looking at commit 
message (http://hg.fr.freebsd.org/freebsd-src-head/rev/c60e41c6690f) I'm 
afraid that I'm not able to consider all consequences if I'd introduce 
similar change in DragonFly.


-- 
Hasso Tepper



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]