Note: the corresponding ICU ticket is not in reviewing state. https://codereview.appspot.com/340990043/diff/1/icu4c/source/i18n/number_decimalquantity.cpp File icu4c/source/i18n/number_decimalquantity.cpp (right): https://codereview.appspot.com/340990043/diff/1/icu4c/source/i18n/number_decimalquantity.cpp#newcode1013 ...
Note: the corresponding ICU ticket is not in reviewing state.
https://codereview.appspot.com/340990043/diff/1/icu4c/source/i18n/number_deci...
File icu4c/source/i18n/number_decimalquantity.cpp (right):
https://codereview.appspot.com/340990043/diff/1/icu4c/source/i18n/number_deci...
icu4c/source/i18n/number_decimalquantity.cpp:1013: UnicodeString
DecimalQuantity::toNumberString() const {
On 2018/03/30 07:11:51, sffc wrote:
> Since my change puts this function in the critical path of parsing, I spent a
> little time trying to optimize it. I think UnicodeString append operations
are
> very fast. Does this seem reasonable? Can you think of a better way to do
> this, go from BCD to a string of the form "###E###"?
This seems good to me. You could construct the UnicodeString with an estimate of
the needed capacity, but I don't think it's worth the trouble - the stack buffer
holds 27, which statistically covers everything that matters for performance.
https://codereview.appspot.com/340990043/diff/1/icu4c/source/i18n/number_deci...
icu4c/source/i18n/number_decimalquantity.cpp:1029: result.insert(insertIndex,
u'0' + (_scale % 10));
there's a stdlib.h function div() that will give you the quotient and remainder
in a single operation. (CPU divide instructions give both).
https://codereview.appspot.com/340990043/diff/1/icu4c/source/test/intltest/nu...
File icu4c/source/test/intltest/numbertest_decimalquantity.cpp (right):
https://codereview.appspot.com/340990043/diff/1/icu4c/source/test/intltest/nu...
icu4c/source/test/intltest/numbertest_decimalquantity.cpp:298: void
DecimalQuantityTest::testToDouble() {
Does the new double implementation work with the old IBM mainframe double
format?
https://codereview.appspot.com/340990043/diff/1/icu4c/source/test/intltest/nu...
icu4c/source/test/intltest/numbertest_decimalquantity.cpp:304: { "-3.142E-271",
-3.142e-271 } };
What is the significance of these specific numbers?
Issue 340990043: ticket:13672 Enabling double_conversion StringToDoubleConverter and using it in DecimalQuantity's t…
(Closed)
Created 6 years ago by sffc
Modified 5 years, 12 months ago
Reviewers: andy.heninger
Base URL: svn+icussh://source.icu-project.org/repos/icu/trunk/
Comments: 8