C++17-Style Hex Floats (And How To Parse Them)

C++17 added support for hex float literals, so you can put more bit-accurate floating point values into your code. They’re handy to have, and I wanted to be able to parse them from a text file in a C# app I was writing. Some examples: 0x1.0p0 // == 1.0 0x1.8p1 // == 3 0x8.0p-3 // == 1.0 0x0.8p1 // == 1.0 0xAB.CDEFp-10 // == 0.16777776181697846 0x0.0000000ABp0 // == 2.4883775040507317E-09 What Am I…