Crate result_float[−][src]
This crate contains floating point types that error if they are set to NaN.
Examples
use result_float::{rf, Rf64, Result}; fn geometric_mean(a: Rf64, b: Rf64) -> Result<f64> { (a * b)?.sqrt() } fn mean(a: Rf64, b: Rf64) -> Result<f64> { (a + b)? * rf(0.5)? } println!("geometric_mean(10.0, 20.0) = {}", geometric_mean(rf(10.0)?, rf(20.0)?)?); //prints 14.142... assert!(mean(rf(10.0)?, rf(20.0)?)? == rf(15.0)?);
Structs
NaN |
An error which is returned when an operation returns NaN. |
ResultFloat |
A floating point number that cannot store NaN. |
Functions
rf |
Shorthand for |
Type Definitions
Result |
The type returned by most |
Rf32 |
A floating point number behaving like |
Rf64 |
A floating point number behaving like |