]> git.saurik.com Git - apple/icu.git/blobdiff - icuSources/i18n/reldatefmt.cpp
ICU-62123.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / reldatefmt.cpp
index 38bfe96284f4da76f344b762205626817b0ee32b..aad026cb62d12897c307d57a07430908a950952e 100644 (file)
@@ -14,6 +14,7 @@
 
 #if !UCONFIG_NO_FORMATTING && !UCONFIG_NO_BREAK_ITERATION
 
+#include <cmath>
 #include "unicode/dtfmtsym.h"
 #include "unicode/ucasemap.h"
 #include "unicode/ureldatefmt.h"
@@ -560,7 +561,7 @@ struct RelDateTimeFmtDataSink : public ResourceSink {
 RelDateTimeFmtDataSink::~RelDateTimeFmtDataSink() {}
 } // namespace
 
-DateFormatSymbols::DtWidthType styleToDateFormatSymbolWidth[UDAT_STYLE_COUNT] = {
+static const DateFormatSymbols::DtWidthType styleToDateFormatSymbolWidth[UDAT_STYLE_COUNT] = {
   DateFormatSymbols::WIDE, DateFormatSymbols::SHORT, DateFormatSymbols::NARROW
 };
 
@@ -849,7 +850,7 @@ UnicodeString& RelativeDateTimeFormatter::formatNumeric(
             return appendTo;
     }
     UDateDirection direction = UDAT_DIRECTION_NEXT;
-    if (offset < 0) {
+    if (std::signbit(offset)) { // needed to handle -0.0
         direction = UDAT_DIRECTION_LAST;
         offset = -offset;
     }