aboutsummaryrefslogtreecommitdiff
path: root/src/format/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/format/mod.rs')
-rw-r--r--src/format/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/format/mod.rs b/src/format/mod.rs
index 2ba7ad9..ee77042 100644
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -36,6 +36,14 @@ fn radix_fmt(number: f64, obase: usize) -> Result<String, CalcError> {
36 return Err(CalcError::Math(Math::UnknownBase)); 36 return Err(CalcError::Math(Math::UnknownBase));
37 } 37 }
38 38
39 if number.is_infinite(){
40 return Ok("Inf".to_string());
41 }
42
43 if number.is_nan(){
44 return Ok("Nan".to_string());
45 }
46
39 let table: Vec<char> = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect(); 47 let table: Vec<char> = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect();
40 48
41 // format integral part of float 49 // format integral part of float