[PATCH 0/3] ARM with only 32-bit floats do not have fast 64-bit FMA
Keith Packard
keithp@keithp.com
Wed Sep 2 05:35:42 GMT 2020
"Keith Packard" <keithp@keithp.com> writes:
> That implementation violates the spec though because it does two
> binary operations involving two roundings, so you get a different answer
> than you would with a true fma.
Hrm. C99 and C17 both have macros to detect whether fma is 'fast' or
not: FP_FAST_FMA, FP_FAST_FMAF and FP_FAST_FMAL. This page:
https://en.cppreference.com/w/cpp/numeric/math/fma
has a nice parenthetical comment:
"If ... defined, the function std::fma evaluates faster (in addition to
being more precise) than the expression x*y+z."
If C99 or C17 included 'in addition to being more precise', it would
be much more obvious to me that we should include the fall-back fma
implementation.
So, we should at least change the CPP defines that we have in
math_config.h to match the C99 and C17 specs.
Is it reasonable to assume that applications which care about accuracy
will also be checking these defines and using them as the C++ standard
appears to?
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20200901/d84b0956/attachment.sig>
More information about the Newlib
mailing list