Proposal: Hexadecimal floating point constants
nbowler at elliptictech.com
Tue Feb 23 09:56:30 EST 2010
On 12:26 Sat 20 Feb , Heinrich Apfelmus wrote:
> Nick Bowler wrote:
> > Similarly, the greatest finite double value can be written as
> > 0x1.fffffffffffffp+1023.
> > These constants have the form
> > 0x[HH][.HHHHH]p[+/-]DDD
> 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 .
Indeed, I have already implemented such a function. My gripe here is
that it's extremely cumbersome to use such a function in a program, and
it adds the possibily of programs crashing due to syntax errors at
On 13:15 Mon 22 Feb , Simon Peyton-Jones wrote:
> Or, alternatively, use quasiquoting
> [hex| 1.fffffp+1023 |]
Ah, I was not aware of this feature. It does seem like a decent
solution, in that it allows errors to be caught at compile time.
Somewhat more verbose than I had hoped, but it's probably fine.
Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)
More information about the Haskell-prime