testing - C++ Is there a guarantee of constancy of untouched float values? -
testing - C++ Is there a guarantee of constancy of untouched float values? -
i know if can assume value of float not alter if pass around functions, without farther calculations. write tests kind of functions using hardcoded values.
example :
float identity(float f) { homecoming f; }
can write next test :
test() { expect(identity(1.8f) == 1.8f); }
in general c++ standard doesn't create guarantees if it's known guarantee lead sub-optimal code processor architecture.
the legacy x86 floating point processing uses 80-bit registers calculations. mere deed of moving value 1 of registers 64 bits of memory causes rounding occur.
c++ testing
Comments
Post a Comment