- inf
- NaN
Infinite floating point numbers
- You get inf or -inf if you devide by 0.0 or -0.0 respectively.
- Adding inf to -inf yields a NaN.
- Integers don't have infinite values.
examples/numbers/infinite-floating-point-number/src/main.rs
fn main() { let infinite = 1.0 / 0.0; println!("{}", infinite); let negative_infinite = 1.0 / -0.0; println!("{}", negative_infinite); let what = infinite + negative_infinite; println!("{}", what); // Integers don't handle infinite // let infinite = 1/0; // ^^^ attempt to divide `1_i32` by zero //println!("{}", infinite); }
inf -inf NaN