Created
January 4, 2022 16:26
-
-
Save eduardonunesp/732b84934f9fbd37c0821419aa41add7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::f32; | |
use std::f64; | |
let largest: u64 = 0xfffffffffffff; | |
let zero: u64 = 0x10000000000000; | |
let num = 1_000_000u64; | |
let flt = 123.4f64; // Double-like | |
let fp2 = 0.1f32; // Float-like | |
let fp3 = 12E+99_f64; //Exponents | |
let fp4 = 1e0; // 1.0 | |
let fp5 = 1.3e-1; // | |
let fp = 123e+10; | |
let fp = 1.0e-40_32; | |
let lowest = f32::MIN_POSITIVE; | |
let max = f32::MAX; | |
format!("", 1.0) == ""; | |
// https://github.com/rust-lang/rust/issues/10843 | |
format!("{:e}", 1.0) == "1e0"; | |
format!("{:e}", 10.0) == "1e1"; | |
format!("{:+e}", 10.0) == "+1e+1"; | |
format!("{:e}", 1.1234567) == "1.123457e0"; | |
format!("{:e}", 1.3e-1) == "1.3e-1"; | |
format!("{:.2e}", 1.3e-1) == "1.30e-1"; | |
format!("{:E}", 1.3e-1) == "1.3E-1"; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment