Compare commits
2 Commits
ab04dcea5d
...
e224c5422a
Author | SHA1 | Date |
---|---|---|
Elfein Landers | e224c5422a | |
Elfein Landers | 29856381e5 |
11
src/main.rs
11
src/main.rs
|
@ -20,9 +20,15 @@ fn hex_float(h: f64) -> String {
|
|||
h *= 16.0;
|
||||
e += 1;
|
||||
}
|
||||
|
||||
let mut h = h as usize;
|
||||
let mut output = String::new();
|
||||
|
||||
if e == 0 {
|
||||
output.push('0');
|
||||
output.push('.');
|
||||
}
|
||||
|
||||
let mut num_divides = 0;
|
||||
while h > 0 {
|
||||
output.push(match h % 16 {
|
||||
|
@ -51,11 +57,6 @@ fn hex_float(h: f64) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
if e == 0 {
|
||||
output.push('.');
|
||||
output.push('0');
|
||||
}
|
||||
|
||||
if neg {
|
||||
output.push('-');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue