aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/format/mod.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/format/mod.rs b/src/format/mod.rs
index ee77042..3e3ade2 100644
--- a/src/format/mod.rs
+++ b/src/format/mod.rs
@@ -36,12 +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(){ 39 match (number.is_infinite(), number.is_sign_positive()) {
40 return Ok("Inf".to_string()); 40 (true, true) => return Ok("inf".to_string()),
41 (true, false) => return Ok("-inf".to_string()),
42 _ => ()
41 } 43 }
42 44
43 if number.is_nan(){ 45 if number.is_nan(){
44 return Ok("Nan".to_string()); 46 return Ok("nan".to_string());
45 } 47 }
46 48
47 let table: Vec<char> = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect(); 49 let table: Vec<char> = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".chars().collect();