You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.5 KiB

  1. From 8fda72f6d8e442c5382f21cdd884e2c962bb53bd Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Wed, 11 Dec 2019 13:25:32 -0800
  4. Subject: [PATCH] ICU-20877 i18n: Don't use C++11 math
  5. It's not available with some libc implementations. Specifically,
  6. BIONIC and uClibc-ng. uprv_ variants are available.
  7. Signed-off-by: Rosen Penev <rosenp@gmail.com>
  8. ---
  9. i18n/decimfmt.cpp | 2 +-
  10. i18n/number_decimalquantity.cpp | 2 +-
  11. 2 files changed, 2 insertions(+), 2 deletions(-)
  12. diff --git a/i18n/decimfmt.cpp b/i18n/decimfmt.cpp
  13. index 4015250e273..0cbaca7e099 100644
  14. --- a/i18n/decimfmt.cpp
  15. +++ b/i18n/decimfmt.cpp
  16. @@ -1801,7 +1801,7 @@ bool DecimalFormat::fastFormatDouble(double input, UnicodeString& output) const
  17. return false;
  18. }
  19. if (std::isnan(input)
  20. - || std::trunc(input) != input
  21. + || uprv_trunc(input) != input
  22. || input <= INT32_MIN
  23. || input > INT32_MAX) {
  24. return false;
  25. diff --git a/i18n/number_decimalquantity.cpp b/i18n/number_decimalquantity.cpp
  26. index abbc23de032..778feb141b4 100644
  27. --- a/i18n/number_decimalquantity.cpp
  28. +++ b/i18n/number_decimalquantity.cpp
  29. @@ -452,7 +452,7 @@ void DecimalQuantity::_setToDoubleFast(double n) {
  30. for (; i <= -22; i += 22) n /= 1e22;
  31. n /= DOUBLE_MULTIPLIERS[-i];
  32. }
  33. - auto result = static_cast<int64_t>(std::round(n));
  34. + auto result = static_cast<int64_t>(uprv_round(n));
  35. if (result != 0) {
  36. _setToLong(result);
  37. scale -= fracLength;