[][src]Module actyxos_sdk::types::fixnum_types

collection of useful types for use with FixNum

Example

use actyxos_sdk::types::{FixNum, fixnum_types::U32};

// convert to fixed-point number with 32 bits fractional part, saturating on overflow
let a: FixNum<U32> = FixNum::<U32>::saturating(12345);

// convert it to a float
let f = a.to_num_checked::<f64>().unwrap();
assert_eq!(f, 12345f64);

// convert a float to fixed-point, wrapping around on overflow
let b: FixNum<U32> = FixNum::wrapping(13.7e250f64);

Re-exports

pub use fixed::traits::FromFixed;
pub use fixed::traits::LossyFrom;
pub use fixed::traits::LossyInto;
pub use fixed::traits::ToFixed;
pub use fixed::types::extra::*;
pub use fixed::FixedI128;