The documentation stated that Conversion is handled like this: (value * coefficient()) + constant()
But using this code snipped for a manual conversion like Fahrenheit to Kelvin this breaks:
fn test() {
let f: f32 = 2.0;
let k = convert::<uom::si::thermodynamic_temperature::degree_fahrenheit>(f);
println!("{k:?}");
}
fn convert<N>(value: f32) -> f32
where
N: uom::Conversion<f32, T = f32>,
{
(value * N::coefficient()) + N::constant(uom::ConstantOp::Add)
}
The result is 460.78113, but 2 degrees Fahrenheit is 256.483
Rewriting the equation to (value + constant()) * coefficient() results in 256.48337
So there is an inconsistency between code and documentation.
The documentation stated that Conversion is handled like this:
(value * coefficient()) + constant()But using this code snipped for a manual conversion like Fahrenheit to Kelvin this breaks:
The result is
460.78113, but 2 degrees Fahrenheit is256.483Rewriting the equation to
(value + constant()) * coefficient()results in256.48337So there is an inconsistency between code and documentation.