For decimal and scientific numbers (e.g., 1.23, 3.12e10).
Examples:
1.23is syntax forOfScientific.ofScientific (nat_lit 123) true (nat_lit 2)121e100is 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.
Instances
@[defaultInstance 501]
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
- instOfScientificFloat = { ofScientific := Float.ofScientific }
@[export lean_float_of_nat]
Equations
Instances For
Equations
- Float.ofInt (Int.ofNat n) = Float.ofNat n
- Float.ofInt (Int.negSucc n) = (Float.ofNat n.succ).neg
Instances For
Equations
- instOfNatFloat = { ofNat := Float.ofNat n }
Equations
- instOfScientificFloat32 = { ofScientific := Float32.ofScientific }
@[export lean_float32_of_nat]
Equations
Instances For
Equations
- Float32.ofInt (Int.ofNat n) = Float32.ofNat n
- Float32.ofInt (Int.negSucc n) = (Float32.ofNat n.succ).neg
Instances For
Equations
- instOfNatFloat32 = { ofNat := Float32.ofNat n }