aboutsummaryrefslogtreecommitdiff
path: root/src/format/mod.rs
diff options
context:
space:
mode:
authorMilan Markovic <[email protected]>2019-07-02 22:49:27 +0100
committerMilan Markovic <[email protected]>2019-07-02 22:49:27 +0100
commitec7ae4eb7a07e5f9330334247dd6ca1722582f02 (patch)
tree3e8c5ede0f40d198be1e288237d317c9d5f6a868 /src/format/mod.rs
parenta01e3bd9896adcf28a89fbbd09235747319b8113 (diff)
Added inf and nan
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