For decimal and scientific numbers (e.g., 1.23
, 3.12e10
).
Examples:
1.23
is syntax forOfScientific.ofScientific (nat_lit 123) true (nat_lit 2)
121e100
is syntax forOfScientific.ofScientific (nat_lit 121) false (nat_lit 100)
Note the use of nat_lit
; there is no wrapping OfNat.ofNat
in the resulting term.
Produces a value from the given mantissa, exponent sign, and decimal exponent. For the exponent sign,
true
indicates a negative exponent.Examples:
1.23
is syntax forOfScientific.ofScientific (nat_lit 123) true (nat_lit 2)
121e100
is syntax forOfScientific.ofScientific (nat_lit 121) false (nat_lit 100)
Note the use of
nat_lit
; there is no wrappingOfNat.ofNat
in the resulting term.
Instances
Computes m * 2^e
.
Equations
Instances For
Constructs a Float
from the given mantissa, sign, and exponent values.
This function is part of the implementation of the OfScientific Float
instance that is used to
interpret floating-point literals.
The OfScientific Float
must have priority higher than mid
since
the default instance Neg Int
has mid
priority.
#check -42.0 -- must be Float
Equations
Converts a natural number into the closest-possible 64-bit floating-point number, or an infinite
floating-point value if the range of Float
is exceeded.
Equations
Instances For
Converts an integer into the closest-possible 64-bit floating-point number, or positive or negative
infinite floating-point value if the range of Float
is exceeded.
Equations
Instances For
Converts a natural number into the closest-possible 64-bit floating-point number, or an infinite
floating-point value if the range of Float
is exceeded.
Equations
Instances For
Computes m * 2^e
.
Equations
Instances For
Constructs a Float32
from the given mantissa, sign, and exponent values.
This function is part of the implementation of the OfScientific Float32
instance that is used to
interpret floating-point literals.
Converts a natural number into the closest-possible 32-bit floating-point number, or an infinite
floating-point value if the range of Float32
is exceeded.
Equations
Instances For
Converts an integer into the closest-possible 32-bit floating-point number, or positive or negative
infinite floating-point value if the range of Float32
is exceeded.
Equations
Instances For
Converts a natural number into the closest-possible 32-bit floating-point number, or an infinite
floating-point value if the range of Float32
is exceeded.