I'm developing on OS portable software that has unit tests that must work on Linux, UNIX, and Windows.
Imagine this unit test that asserts that the IEEE single-precision floating point value 1.26743237e+015f is converted to a string:
void DataTypeConvertion_Test::TestToFloatWide()
{
CDataTypeConversion<wchar_t> dataTypeConvertion;
float val = 1.26743237e+015f;
wchar_t *valStr = (wchar_t*)dataTypeConvertion.ToFloat(val);
std::wcout << valStr << std::endl;
int result = wcscmp(L"1.26743E+015", valStr);
CPPUNIT_ASSERT_EQUAL(0, result);
delete [] valStr;
}
My question is: Will all OS and processors convert the float to the string "1.26743E+015" as long as the float is a IEEE? I'm asking since I know the math CPUs may not return accurate results, and I was wondering if that would yield different results on different processors as they may have different hardware implementations of IEEE floating point operations internally inside the processor architecture.