[PATCH 1/2] Avoid implicit floating point conversions [v2]

Thomas Wucher thomas.wucher@gtd-gmbh.de
Tue Aug 25 13:37:51 GMT 2020


On 24.08.20 08:33, Keith Packard via Newlib wrote:
> Corinna Vinschen via Newlib <newlib@sourceware.org> 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?

We would prefer the use of the standard C/Posix macros. This way the exact
inf/nan return value can be controlled at a central point in the library
and does not depend on a specific compiler implementation of the
builtins.

This ensures reproducible results across different compilers.

>
> --
> -keith

Regards
Thomas



More information about the Newlib mailing list