lundi 28 septembre 2015

C++11 hexfloat compile-time parsing

The C99 language features the ability to directly specify the exponent and mantissa of a binary floating point literal (hence referred to as "hexfloats"), e.g. 0x1.0p0 is 1 * pow(2, 0), or 1.0. The C++11 standard includes the C99 standard library, including the ability to serialize and deserialize hexfloats from strings, but for some mysterious reason does not include the literals themslves.

(1) Why did the language committee not add this very simple feature that is pretty much essential for numeric computing?

(2) How can I implement compile-time hexfloat parsing in the C++11 subset supported by Visual Studio 2013? GCC allows hexfloat literals in C++, so this is not a problem in the GNU world.

Aucun commentaire:

Enregistrer un commentaire