summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>2008-03-05 11:21:14 +0000
committerbde <bde@FreeBSD.org>2008-03-05 11:21:14 +0000
commit20db6615faf6a4e6ece21b60ea28771910348f23 (patch)
treee063c9bfac3e22b88640073d0103a191959b7b5d /sys
parentb5ae836fd2e75759fee409a4ecd3aec50c69d8fc (diff)
downloadFreeBSD-src-20db6615faf6a4e6ece21b60ea28771910348f23.zip
FreeBSD-src-20db6615faf6a4e6ece21b60ea28771910348f23.tar.gz
Change float_t and double_t to long double on i386. All floating point
expressions on i386 are evaluated in the range of the long double type, so this is wrong in a different but hopefully less worse way than before. Since expressions are evaluated in long double registers, there is no runtime cost to using long double instead of double to declare intermediate values (except in cases where this avoids compiler bugs), and by careful use of float_t or double_t it is possible to avoid some of the compiler bugs in this area, provided these types are declared as long double. I was going to change float.h to be less broken and more usable in combination with the change here (in particular, it is more necessary to know the effective number of bits in a double_t when double_t != double, since DBL_MANT_DIG no longer logically gives this, and LDBL_MANT_DIG doesn't give it either with FreeBSD-i386's default rounding precision. However, this was too hard for now. In particular, LDBL_MANT_DIG is used a lot in libm, so it cannot be changed. One thing that is completely broken now is LDBL_MAX. This may have sort of worked when it was changed from DBL_MAX in 2002 (adding 0 to it at runtime gave +Inf, but you could at least compare with it), but starting with gcc-3.3.1 in 2003, it is always +Inf due to evaluating it at compile time in the default rounding precision.
Diffstat (limited to 'sys')
-rw-r--r--sys/i386/include/_types.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/i386/include/_types.h b/sys/i386/include/_types.h
index b272cf0..9810e0e 100644
--- a/sys/i386/include/_types.h
+++ b/sys/i386/include/_types.h
@@ -76,8 +76,8 @@ typedef unsigned long long __uint64_t;
typedef unsigned long __clock_t; /* clock()... */
typedef unsigned int __cpumask_t;
typedef __int32_t __critical_t;
-typedef double __double_t;
-typedef double __float_t;
+typedef long double __double_t;
+typedef long double __float_t;
typedef __int32_t __intfptr_t;
typedef __int64_t __intmax_t;
typedef __int32_t __intptr_t;
OpenPOWER on IntegriCloud