ppc float.h
Andreas Tobler
andreast-list at fgznet.ch
Sun Nov 16 11:02:15 PST 2008
Hi Peter,
Peter Grehan wrote:
>> Coming back to myself. Doesn't matter if going to 128-bit
> long double or
>> not. The LDBL_MIN/MAX/EPSILON definitions in float.h are wrong.
>>
>> If you do a printf ("%Lf\n", LDBL_EPSILON); you run into a
> compiler warning:
>> warning: format '%Lf' expects type 'long double', but
> argument 2 has
>> type 'double'
>>
>> So to fix that I propose the appended patch.
>>
>> Thanks,
>> Andreas
>>
>> P.S, making the compiler work with 128-bit long-double is
> still possible.
>
> I'm way out of my depth here. You probably want to speak to
> David Schulz (das at freebsd.org) - he's the floating point goto guy.
Did so. You have the answer as well.
quote <das at freebsd.org>:
----
Yes, I think you're right, except it might be cleaner just to say:
#define LDBL_EPSILON (long double)DBL_EPSILON
and similarly for the other values.
----
quote end
This is the tested patch. Is this the right place to send it to?
Thanks,
Andreas
--- float.h.orig 2008-11-15 19:03:12.000000000 +0100
+++ float.h 2008-11-16 19:57:40.000000000 +0100
@@ -72,13 +72,13 @@
#define DBL_MAX_10_EXP 308
#define LDBL_MANT_DIG DBL_MANT_DIG
-#define LDBL_EPSILON DBL_EPSILON
+#define LDBL_EPSILON (long double)DBL_EPSILON
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
+#define LDBL_MIN (long double)DBL_MIN
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
+#define LDBL_MAX (long double)DBL_MAX
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#endif /* _MACHINE_FLOAT_H_ */
More information about the freebsd-ppc
mailing list