ppc float.h
Andreas Tobler
andreast-list at fgznet.ch
Fri Nov 14 13:02:34 PST 2008
Hi Peter,
Andreas Tobler wrote:
> Peter Grehan wrote:
>
>>> can somebody explain why we have these defines in
>>> sys/powerpc/include/float.h ?
>>
>> Have a look at
>>
>> http://svn.freebsd.org/viewvc/base?view=revision&revision=132421
>
> Hm, meanwhile OS-X has 128-bit long double...
>
>> Basically, the ABI was switched from 128 bit long doubles to
>> 64. Not exactly SVR4 compliant but then no-one else is.
>
> And there is no need to go back to 128-bit? No benefit?
> What would have to be done? Libc? I know the compiler issue.
> Would this break too much?
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.
[wolfram:~] andreast% diff -u float.h~ float.h
--- float.h~ 2008-11-14 21:31:00.000000000 +0100
+++ float.h 2008-11-14 21:32:07.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 2.2204460492503131e-16L
#define LDBL_DIG DBL_DIG
#define LDBL_MIN_EXP DBL_MIN_EXP
-#define LDBL_MIN DBL_MIN
+#define LDBL_MIN 2.2250738585072014e-308L
#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
#define LDBL_MAX_EXP DBL_MAX_EXP
-#define LDBL_MAX DBL_MAX
+#define LDBL_MAX 1.7976931348623157e+308L
#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
#endif /* _MACHINE_FLOAT_H_ */
More information about the freebsd-ppc
mailing list