Maintainer | me@lelf.lu |
---|---|

Safe Haskell | Trustworthy |

This module contains functions for formatting and parsing floating point
values as C99 printf/scanf functions with format string `%a`

do.

The format is [-]0x*h.hhhhh*p*ddd*, where *h.hhhhh* is significand
as a hexadecimal floating-point number and *±dd* is exponent as a
decimal number. Significand has as many digits as needed to exactly
represent the value, fractional part may be ommitted.

Infinity and NaN values are represented as `±in`

and `nan`

accordingly.

For example, `(π ∷ Double) = 0x1.921fb54442d18p+1`

(*exactly*).

This assertion holds (assuming NaN ≡ NaN)

∀x. Just x ≡ readFloat (showFloat x)

Floating point radix is assumed to be 2.

# Documentation

showFloat :: RealFloat a => a -> TextSource

Format a value. Will provide enough digits to reconstruct the value exactly.

floatBuilder :: RealFloat a => a -> BuilderSource

A `Builder`

for a value

readFloatStr :: RealFloat a => String -> Maybe aSource

Deprecated: use readFloat

showFloatStr :: RealFloat a => a -> StringSource

Deprecated: use showFloat