Proposal: Hexadecimal floating point constants
apfelmus at quantentunnel.de
Sat Feb 20 06:26:32 EST 2010
Nick Bowler wrote:
> I'd like to propose what I believe is a simple but valuable extension to
> Haskell that I haven't seen proposed elsewhere.
> C has something it calls hexadecimal floating constants, and it would be
> very nice if Haskell had it too. For floating point systems where the
> radix is a power of two (very common), they offer a means of clearly and
> exactly specifying any finite floating point value.
> Similarly, the greatest finite double value can be written as
> These constants have the form
If you don't want to wait on an (uncertain) inclusion into the Haskell
standard, you can implement a small helper function to that effect
yourself; essentially using encodeFloat .
More information about the Haskell-prime