Is cos(x) required to return identical values in different C++ implementations that use IEEE-754?
Is there any sort of guarantee - either in the C++ standard or in some other document - that C++ code computing cos(x)
will produce identical values when compiled with g++, clang, MSVC, etc., assuming those implementations are using IEEE-754 64-bit double
s and the input value x
is exactly equal? My assumption is "yes," but I'd like to confirm that before relying on this behavior.
Context: I'm teaching a course in which students may need to compute trigonometric functions of inputs. I can assure that those inputs are identical when fed into the functions. I'm aware that equality-testing double
s is not a good idea, but in this specific case I was wondering if it was safe to do so.
from Recent Questions - Stack Overflow https://ift.tt/39P9kkB
https://ift.tt/eA8V8J
Comments
Post a Comment