Expand description
§Rust float-point in constant context
Features:
no_stdconst_trait_implconst_mut_refs
work in stable:
const fn const_f32_add(a: f32, b: f32) -> f32 {
SoftF32(a).add(SoftF32(b)).to_f32()
}with const_trait_impl usage (requires nightly):
const fn const_f32_add(a: f32, b: f32) -> f32 {
(SoftF32(a) + SoftF32(b)).to_f32()
}with const_mut_refs usage (requires nightly):
const fn const_f32_add(a: f32, b: f32) -> f32 {
let mut x = SoftF32(a);
x += SoftF32(b);
x.to_f32()
}