Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Call related modules in standard library
- use std::{i8, i16, i32, i64, isize};
- use std::{u8, u16, u32, u64, usize};
- use std::{f32, f64};
- fn main() {
- // signed, fixed-width integers
- println!("i8 min: {}, max: {}", i8::min_value(), i8::max_value());
- println!("i16 min: {}, max: {}", i16::min_value(), i16::max_value());
- println!("i32 min: {}, max: {}", i32::min_value(), i32::max_value());
- println!("i64 min: {}, max: {}", i64::min_value(), i64::max_value());
- // unsigned, fixed-width integers
- println!("u8 min: {}, max: {}", u8::min_value(), u8::max_value());
- println!("u16 min: {}, max: {}", u16::min_value(), u16::max_value());
- println!("u32 min: {}, max: {}", u32::min_value(), u32::max_value());
- println!("u64 min: {}, max: {}", u64::min_value(), u64::max_value());
- // variable-width integers (platform dependant)
- println!("isize min: {}, max: {}",
- isize::min_value(),
- isize::max_value());
- println!("usize min: {}, max: {}",
- usize::min_value(),
- usize::max_value());
- // floating point numbers
- println!("f32 min: {}, max: {}, min positive: {}",
- f32::MIN,
- f32::MAX,
- f32::MIN_POSITIVE);
- println!("f64 min: {}, max: {}, min positive: {}",
- f64::MIN,
- f64::MAX,
- f64::MIN_POSITIVE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement