[][src]Function surreal::ftos

pub fn ftos(fl: f32) -> Surreal

Converts a floating-point number into a surreal number.

Panics

Given that all floating point numbers, i.e. all finite binary representable numbers, map to a surreal number with non-infinite sets, theoretically there is no case where this function will panic. However, given this function uses the currently broken multiplication feature, ftos() will not work for numbers produced on or after day 4.

Examples

let zero = surreal::Surreal::new(vec![], vec![]);
let one = surreal::Surreal::new(vec![&zero], vec![]);

assert!(surreal::ftos(0.0) == zero);
assert!(surreal::ftos(1.0) == one);