mirror of
https://github.com/tiffany352/rink-rs
synced 2024-11-10 13:44:15 +00:00
Print full value of integers in base 2/8/16/32
This commit is contained in:
parent
0fd73068b4
commit
f175bf69a5
1 changed files with 5 additions and 1 deletions
|
@ -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)) ||
|
||||||
|
|
Loading…
Reference in a new issue