Date: Sun, 16 Nov 2008 20:02:11 +0100 From: Andreas Tobler <andreast-list@fgznet.ch> To: Peter Grehan <grehan@freebsd.org> Cc: FreeBSD PowerPC ML <freebsd-ppc@freebsd.org> Subject: Re: ppc float.h Message-ID: <49206E33.1010407@fgznet.ch> In-Reply-To: <20081115084319.ELQ11380@dommail.onthenet.com.au>
index | next in thread | previous in thread | raw e-mail
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@freebsd.org) - he's the floating point goto guy.
Did so. You have the answer as well.
quote <das@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_ */
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49206E33.1010407>
