@@ -93,7 +93,7 @@ Both implementations expose two public functions:
93
93
94
94
They try to fill the `u8` buffer with digits and returns the number of digits
95
95
written and the exponent `k`. They are total for all finite `f32` and `f64`
96
- inputs (Grisu internally falls back to Dragon if possible ).
96
+ inputs (Grisu internally falls back to Dragon if necessary ).
97
97
98
98
The rendered digits are formatted into the actual string form with
99
99
four functions:
@@ -114,8 +114,8 @@ four functions:
114
114
They all return a slice of preallocated `Part` array, which corresponds to
115
115
the individual part of strings: a fixed string, a part of rendered digits,
116
116
a number of zeroes or a small (`u16`) number. The caller is expected to
117
- provide an enough buffer and `Part` array, and to assemble the final
118
- string from parts itself.
117
+ provide a large enough buffer and `Part` array, and to assemble the final
118
+ string from resulting `Part`s itself.
119
119
120
120
All algorithms and formatting functions are accompanied by extensive tests
121
121
in `coretest::num::flt2dec` module. It also shows how to use individual
@@ -639,9 +639,8 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
639
639
let limit = if frac_digits < 0x8000 { -( frac_digits as i16 ) } else { i16:: MIN } ;
640
640
let ( len, exp) = format_exact ( decoded, & mut buf[ ..maxlen] , limit) ;
641
641
if exp <= limit {
642
- // `format_exact` always returns at least one digit even though the restriction
643
- // hasn't been met, so we catch this condition and treats as like zeroes.
644
- // this does not include the case that the restriction has been met
642
+ // the restriction couldn't been met, so this should render like zero no matter
643
+ // `exp` was. this does not include the case that the restriction has been met
645
644
// only after the final rounding-up; it's a regular case with `exp = limit + 1`.
646
645
debug_assert_eq ! ( len, 0 ) ;
647
646
if frac_digits > 0 { // [0.][0000]
0 commit comments