Boost logo

Boost :

Subject: [boost] Extracting floating point constant exponent/mantissa at compile time
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2009-04-16 03:16:50


I'm seeking a way to perform compile-time "bitwise" casting of floating
value aka
turning a float into an uint32_t value with the same bit pattern.

Eg: -3.14f becoming 0xC048F5C3

I saw a mpl::double_ in the vault but I can't make tail nor head of the
trick used in the large macros.hpp file.
Considering I only need the capability of storing a flaot as a bit
pattern and don't need the additional arithmetic,
can someone enlighten me on the process used in mpl::double ?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk