diff options
author | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2014-04-19 10:59:05 +0000 |
---|---|---|
committer | eschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2014-04-19 10:59:05 +0000 |
commit | 568c2e3b24c630b01e0f3d4c62a536756c1fc561 (patch) | |
tree | 7abf8351b062e6485cbcacc2bc3725b80ba788f4 /doc/UsersGuide/Appendices.tex | |
parent | b9ccfb348184402ee856f6230b66840ab1ec1b64 (diff) |
Provide always-working isnan etc.
Certain math optimization options (e.g. -ffast-math) tell the compiler
that IEEE floating point numbers such as inf and nan do not need to be
handled correctly (in the sense specified by the IEEE standard). This
greatly improves floating-point speed and is commonly used in
numerical HPC applications.
However, since compilers then don't need to handle inf and nan
correctly, they have begun to optimise isnan(x) to simply returning
false all the time. This improves speed (since the check does not
actually need to occur) and reduces code size (since the nan-handling
if branches can be omitted). Of course, this makes it then impossible
to actually check for nan by calling isnan.
Currently, e.g. g++ performs this optimisation, whereas gcc does not.
Things vary with other compilers. In the future, with link-time
optimisations, I expect other compilers to follow g++.
This patch provides functions CCTK_IEEE_isnan etc. that always check
for nan, independent of the chosen optimisation flags.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@5107 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'doc/UsersGuide/Appendices.tex')
0 files changed, 0 insertions, 0 deletions