Re: [PATCH 0/3] ARM with only 32-bit floats do not have fast 64-bit FMA

Keith Packard via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
"Keith Packard" <[email protected]> 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
signature.asc (application/pgp-signature, 832 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEw4O3eCVWE9/bQJ2R2yIaaQAAABEFAl9PLy8ACgkQ2yIaaQAA
ABElUw/+LHRCzPuMZTPvP8X4fDR4gFzF/jCvADbGtuRMatgaIj+axf+A7A5+5db5
d5N4vex0zfpBMMwMHtXYfJoa1XCezXWbuMUMkYtM+2Kd4SGT1sdI9sx+U3TQbe1A
4ZBpxHjc+JkE/mTnoYVECuJpq6RZe87gXbYAJunNGaTNugDpRjYQ79+cYo9tcxhW
KPpaYIL6QsGqCYeYJNVHYFRgCYt8/nYnW77sDjJREdd3jZ+qfprSiXxy+Rtz8ufx
qnHqLDKEcYuzXW3Q3IoKtcWAIl4jhZdCj3jEehVOs37rVAmh+ZLZHcc06/tJ1k5Z
MkCN/2PpTH22xdKeXv9M9ESp70/96fYPzUu4xn0WwKfDCqBqDN3kjxaXtt9wyRhB
+G+UFqzhQoOTG1cFAqNELKTN2V3q3oa6kRgeduXGqw+zNSG2Izhg6b0pIxgNUmfW
+AWfejaMkMBPJ3SmpE8Noxx3iEHPKa0zKZVcst1dNqyuBp3sO+vBTejnaVoK/Sdy
5/Woz8M/d19Tc8wnYxNF8rxr8lnwWUmVkmzCLYwst11vBZWYvBWwO99+dHl64LtQ
WekVwQEWrgPeEgrxbL250GGnedBh2QsK2cWKyabv8q7hO5PkrhUQixZ6YhovnSUd
YznlHXLf6AZawp+63sllUp7R3I2VMjZ1Ba7WN7VBJ0UQf6VOw30=
=7ElC
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.