File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ numbers to decimal strings.
1111This Rust implementation is a line-by-line port of Victor Zverovich's
1212implementation in C++, [ https://github.com/vitaut/zmij ] [ upstream ] .
1313
14- [ upstream ] : https://github.com/vitaut/zmij/tree/ddbc414bd13c4a4e1fbd6af763746bb68ba6a678
14+ [ upstream ] : https://github.com/vitaut/zmij/tree/98d01d3bc6aceb80b8420ea13874e0ae9af0c9e8
1515
1616## Example
1717
Original file line number Diff line number Diff line change @@ -1025,13 +1025,17 @@ where
10251025 ) ;
10261026 }
10271027 let mut dec_exp = dec. exp ;
1028- let threshold = if Float :: NUM_BITS == 64 {
1029- 10_000_000_000_000_000
1030- } else {
1031- 100_000_000
1032- } ;
1033- let extra_digit = dec . sig >= threshold ;
1028+ let extra_digit = dec . sig
1029+ >= if Float :: NUM_BITS == 64 {
1030+ 10_000_000_000_000_000
1031+ } else {
1032+ 100_000_000
1033+ } ;
10341034 dec_exp += Float :: MAX_DIGITS10 as i32 - 2 + i32:: from ( extra_digit) ;
1035+ if Float :: NUM_BITS == 32 && dec. sig < 10_000_000 {
1036+ dec. sig *= 10 ;
1037+ dec_exp -= 1 ;
1038+ }
10351039
10361040 // Write significand.
10371041 let end = if Float :: NUM_BITS == 64 {
@@ -1045,10 +1049,6 @@ where
10451049 )
10461050 }
10471051 } else {
1048- if dec. sig < 10_000_000 {
1049- dec. sig *= 10 ;
1050- dec_exp -= 1 ;
1051- }
10521052 unsafe { write_significand9 ( buffer. add ( 1 ) , dec. sig as u32 , extra_digit) }
10531053 } ;
10541054
You can’t perform that action at this time.
0 commit comments