I have scientific data dumped into files. At the moment I've just dumped them with the same representation as they are in memory. I have documented that they are IEEE754 but I would love to have this asserted in the code so that if it gets ported to a weird architecture and separated from my documentation (research codes get passed around) it errors on compilation. At the moment I have
static_assert(sizeof(double)==8), "message");
Is there a way to test IEEE754? And can that be static asserted?
In C, check if this is defined:
__STDC_IEC_559__
In C++, check if this is true
:
std::numeric_limits<double>::is_iec559()
IEC559, short for International Electrotechnical Commission standard 559,is the same as IEEE 754.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With