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.
This commit is contained in:
parent
3c423712fa
commit
bc7b82cc51
@ -66,13 +66,14 @@ __END_DECLS
|
||||
#define DBL_MAX 1.7976931348623157E+308
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
#define LDBL_MANT_DIG 64
|
||||
#define LDBL_EPSILON 1.0842021724855044340E-19L
|
||||
#define LDBL_MANT_DIG DBL_MANT_DIG
|
||||
#define LDBL_EPSILON DBL_EPSILON
|
||||
#define LDBL_DIG 18
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.3621031431120935063E-4932L
|
||||
#define LDBL_MIN 3.36210314311209350626E-4932L
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.1897314953572317650E+4932L
|
||||
#define LDBL_MAX 1.18973149535723163300E+4932L
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
|
||||
#endif /* _MACHINE_FLOAT_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user