atom feed9 messages in org.freebsd.freebsd-ppcRe: ppc float.h
FromSent OnAttachments
Andreas ToblerNov 12, 2008 11:49 am 
Peter GrehanNov 12, 2008 4:59 pm 
Marcel MoolenaarNov 12, 2008 7:23 pm 
Andreas ToblerNov 13, 2008 11:12 am 
Andreas ToblerNov 13, 2008 11:13 am 
Andreas ToblerNov 14, 2008 1:02 pm 
Peter GrehanNov 14, 2008 2:42 pm 
Andreas ToblerNov 16, 2008 11:01 am 
Marcel MoolenaarNov 16, 2008 11:20 am 
Subject:Re: ppc float.h
From:Andreas Tobler (andr@fgznet.ch)
Date:Nov 16, 2008 11:01:37 am
List:org.freebsd.freebsd-ppc

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.

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 (da@freebsd.org) - he's the floating point goto guy.

Did so. You have the answer as well.

quote <da@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_ */