Re: [PATCH 1/2] Avoid implicit floating point conversions [v2]
Corinna Vinschen via Newlib <[email protected]>
| Newsgroups | gmane.comp.lib.newlib |
|---|---|
| Message-ID | <[email protected]> |
On Aug 24 08:33, Keith Packard via Newlib wrote: > Corinna Vinschen via Newlib <[email protected]> writes: > > > Not taking implicit compiler optimisations into account, wouldn't it > > make more sense to avoid the conversion altogether, using > > __builtin_inf() in these places? > > Yeah, could do that instead. I think it's mostly a matter of what looks > better -- using the "standard" value of INFINITY and casting or using a > compiler internal value without. I think it'll confuse an equal number > of people either way. > > Any preferences? __builtin_inf(), or a sufficiently expressive macro. It's pretty unfortunate that POSIX defines INFINITY and NAN as float, rather than providing type-matching macros as in HUGE_VALF - HUGE_VAL - HUGE_VALL. Something like #define _INF (__builtin_inf()) comes to mind. Corinna