Print full value of integers in base 2/8/16/32

This commit is contained in:
Tiffany Bennett 2016-10-22 11:08:15 -04:00
parent 0fd73068b4
commit f175bf69a5

View file

@ -101,7 +101,11 @@ pub fn to_string(rational: &Num, base: u8) -> (bool, String) {
let mut placed_decimal = false; let mut placed_decimal = false;
loop { loop {
let exact = cursor == zero; let exact = cursor == zero;
let use_sci = intdigits+zeros > 9; let use_sci = if den == one && (base == 2 || base == 8 || base == 16 || base == 32) {
false
} else {
intdigits+zeros > 9 * 10 / base as u32
};
let placed_ints = n >= intdigits; let placed_ints = n >= intdigits;
let bail = let bail =
(exact && (placed_ints || use_sci)) || (exact && (placed_ints || use_sci)) ||