<div dir="ltr">FloatingHex (<a href="http://hackage.haskell.org/package/FloatingHex">http://hackage.haskell.org/package/FloatingHex</a>) is a simple package that implement hexadecimal notation for floating point numbers, as described in p57-58 of <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a><div><br></div><div>The package provides a quasi-quoter for hexadecimal floats: hf, and a pretty-printer for floats to show them in this notation: showFFloat. (Note that the latter is not 100% compatible with C's %a modifier for printf, but it does render a faithful representation of its input.)</div><div><br></div><div>Hex-floats are useful as they allow writing floating-point constants without any loss of precision, while remaining human readable. For instance, the float 2 is written as 0x1p1. (With the quasiquoter, the syntax is [hf|0x1p1|].) This representation is to be preferred over decimal rendering where loss of precision can be a problem: Note that not all floating point numbers have a terminating decimal representation as currently required by the Haskell syntax.</div><div><br></div><div>It would be nice if Haskell itself allowed for such literals in the language specs itself, following the recent changes to other language standards. (Again, see p57-58 of <a href="http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf">http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf</a> for the new C standard.) In the mean time, I hope FloatingHex library will provide a workaround for the numerophilias amongst us.</div><div><br></div><div>Bug reports and improvements always welcome!</div><div><br></div><div>Cheers,</div><div><br></div><div>-Levent.</div><div><div><br></div><div><br></div></div></div>