]> granicus.if.org Git - icu/commitdiff
ICU-21484 Add SignDisplay NEGATIVE
authorShane F. Carr <shane@unicode.org>
Thu, 4 Feb 2021 04:50:47 +0000 (22:50 -0600)
committerShane F. Carr <shane@unicode.org>
Thu, 25 Feb 2021 02:10:27 +0000 (03:10 +0100)
12 files changed:
docs/userguide/format_parse/numbers/skeletons.md
icu4c/source/i18n/number_formatimpl.cpp
icu4c/source/i18n/number_patternstring.cpp
icu4c/source/i18n/number_skeletons.cpp
icu4c/source/i18n/number_skeletons.h
icu4c/source/i18n/unicode/unumberformatter.h
icu4c/source/test/intltest/numbertest_api.cpp
icu4j/main/classes/core/src/com/ibm/icu/impl/number/PatternStringUtils.java
icu4j/main/classes/core/src/com/ibm/icu/number/NumberFormatter.java
icu4j/main/classes/core/src/com/ibm/icu/number/NumberFormatterImpl.java
icu4j/main/classes/core/src/com/ibm/icu/number/NumberSkeletonImpl.java
icu4j/main/tests/core/src/com/ibm/icu/dev/test/number/NumberFormatterApiTest.java

index 6e4986f9677326d8d0a5ca568796f9f66569fd70..227ea302f96e8ccefdd2cd81a9ec1414206a5bd1 100644 (file)
@@ -349,6 +349,8 @@ The following stems specify sign display:
 - `sign-accounting-always` or `()!` (concise)
 - `sign-except-zero` or `+?` (concise)
 - `sign-accounting-except-zero` or `()?` (concise)
+- `sign-negative` or `+-` (concise)
+- `sign-accounting-negative` or `()-` (concise)
 
 For more details, see
 [`UNumberSignDisplay`](https://unicode-org.github.io/icu-docs/apidoc/released/icu4c/unumberformatter_8h.html).
index eb904dcd2ee087cfb5f5761b764877c99d2487b9..b2325aa8e591eb276d836af133089a022e7d6ad6 100644 (file)
@@ -139,8 +139,10 @@ NumberFormatterImpl::macrosToMicroGenerator(const MacroProps& macros, bool safe,
     bool isPermille = utils::unitIsPermille(macros.unit);
     bool isCompactNotation = macros.notation.fType == Notation::NTN_COMPACT;
     bool isAccounting =
-            macros.sign == UNUM_SIGN_ACCOUNTING || macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS ||
-            macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
+            macros.sign == UNUM_SIGN_ACCOUNTING ||
+            macros.sign == UNUM_SIGN_ACCOUNTING_ALWAYS ||
+            macros.sign == UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO ||
+            macros.sign == UNUM_SIGN_ACCOUNTING_NEGATIVE;
     CurrencyUnit currency(u"", status);
     if (isCurrency) {
         currency = CurrencyUnit(macros.unit, status); // Restore CurrencyUnit from MeasureUnit
index 9d845056069b800f78f283102a54519f199505dd..ac9e8b7e8e4d7521841a2f8f01acc04e1467b8c8 100644 (file)
@@ -1106,6 +1106,20 @@ PatternSignType PatternStringUtils::resolveSignDisplay(UNumberSignDisplay signDi
             }
             break;
 
+        case UNUM_SIGN_NEGATIVE:
+        case UNUM_SIGN_ACCOUNTING_NEGATIVE:
+            switch (signum) {
+                case SIGNUM_NEG:
+                    return PATTERN_SIGN_TYPE_NEG;
+                case SIGNUM_NEG_ZERO:
+                case SIGNUM_POS_ZERO:
+                case SIGNUM_POS:
+                    return PATTERN_SIGN_TYPE_POS;
+                default:
+                    break;
+            }
+            break;
+
         case UNUM_SIGN_NEVER:
             return PATTERN_SIGN_TYPE_POS;
 
index 53ebf80c0421614f8ccefdcaee2cc15d57e16887..5aae55537c719a52759100609dd28bba3df77e2b 100644 (file)
@@ -91,6 +91,8 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) {
     b.add(u"sign-accounting-always", STEM_SIGN_ACCOUNTING_ALWAYS, status);
     b.add(u"sign-except-zero", STEM_SIGN_EXCEPT_ZERO, status);
     b.add(u"sign-accounting-except-zero", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
+    b.add(u"sign-negative", STEM_SIGN_NEGATIVE, status);
+    b.add(u"sign-accounting-negative", STEM_SIGN_ACCOUNTING_NEGATIVE, status);
     b.add(u"decimal-auto", STEM_DECIMAL_AUTO, status);
     b.add(u"decimal-always", STEM_DECIMAL_ALWAYS, status);
     if (U_FAILURE(status)) { return; }
@@ -121,6 +123,8 @@ void U_CALLCONV initNumberSkeletons(UErrorCode& status) {
     b.add(u"()!", STEM_SIGN_ACCOUNTING_ALWAYS, status);
     b.add(u"+?", STEM_SIGN_EXCEPT_ZERO, status);
     b.add(u"()?", STEM_SIGN_ACCOUNTING_EXCEPT_ZERO, status);
+    b.add(u"+-", STEM_SIGN_NEGATIVE, status);
+    b.add(u"()-", STEM_SIGN_ACCOUNTING_NEGATIVE, status);
     if (U_FAILURE(status)) { return; }
 
     // Build the CharsTrie
@@ -278,6 +282,10 @@ UNumberSignDisplay stem_to_object::signDisplay(skeleton::StemEnum stem) {
             return UNUM_SIGN_EXCEPT_ZERO;
         case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
             return UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO;
+        case STEM_SIGN_NEGATIVE:
+            return UNUM_SIGN_NEGATIVE;
+        case STEM_SIGN_ACCOUNTING_NEGATIVE:
+            return UNUM_SIGN_ACCOUNTING_NEGATIVE;
         default:
             return UNUM_SIGN_COUNT; // for objects, throw; for enums, return COUNT
     }
@@ -399,6 +407,12 @@ void enum_to_stem_string::signDisplay(UNumberSignDisplay value, UnicodeString& s
         case UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO:
             sb.append(u"sign-accounting-except-zero", -1);
             break;
+        case UNUM_SIGN_NEGATIVE:
+            sb.append(u"sign-negative", -1);
+            break;
+        case UNUM_SIGN_ACCOUNTING_NEGATIVE:
+            sb.append(u"sign-accounting-negative", -1);
+            break;
         default:
             UPRV_UNREACHABLE;
     }
@@ -697,6 +711,8 @@ skeleton::parseStem(const StringSegment& segment, const UCharsTrie& stemTrie, Se
         case STEM_SIGN_ACCOUNTING_ALWAYS:
         case STEM_SIGN_EXCEPT_ZERO:
         case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+        case STEM_SIGN_NEGATIVE:
+        case STEM_SIGN_ACCOUNTING_NEGATIVE:
             CHECK_NULL(seen, sign, status);
             macros.sign = stem_to_object::signDisplay(stem);
             return STATE_NULL;
@@ -1205,6 +1221,7 @@ void blueprint_helpers::parseScientificStem(const StringSegment& segment, MacroP
             } else if (segment.charAt(offset) == u'?') {
                 signDisplay = UNUM_SIGN_EXCEPT_ZERO;
             } else {
+                // NOTE: Other sign displays are not included because they aren't useful in this context
                 goto fail;
             }
             offset++;
index 201267e635cd6a90e1b712646dc67dba7092be72..5c1055b21c33abe4abdf980230ff1a0d9fdee901 100644 (file)
@@ -108,6 +108,8 @@ enum StemEnum {
     STEM_SIGN_ACCOUNTING_ALWAYS,
     STEM_SIGN_EXCEPT_ZERO,
     STEM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+    STEM_SIGN_NEGATIVE,
+    STEM_SIGN_ACCOUNTING_NEGATIVE,
     STEM_DECIMAL_AUTO,
     STEM_DECIMAL_ALWAYS,
 
index 754987aea0923b6daaa7ba39963f93bdf76588f6..bd1164d6a8a4988b2f856224e38a59af108269e9 100644 (file)
@@ -314,9 +314,12 @@ typedef enum UNumberSignDisplay {
      * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is the default
      * behavior.
      *
+     * If using this option, a sign will be displayed on negative zero, including negative numbers
+     * that round to zero. To hide the sign on negative zero, use the NEGATIVE option.
+     *
      * @stable ICU 60
      */
-            UNUM_SIGN_AUTO,
+    UNUM_SIGN_AUTO,
 
     /**
      * Show the minus sign on negative numbers and the plus sign on positive numbers, including zero.
@@ -324,14 +327,14 @@ typedef enum UNumberSignDisplay {
      *
      * @stable ICU 60
      */
-            UNUM_SIGN_ALWAYS,
+    UNUM_SIGN_ALWAYS,
 
     /**
      * Do not show the sign on positive or negative numbers.
      *
      * @stable ICU 60
      */
-            UNUM_SIGN_NEVER,
+    UNUM_SIGN_NEVER,
 
     /**
      * Use the locale-dependent accounting format on negative numbers, and do not show the sign on positive numbers.
@@ -347,7 +350,7 @@ typedef enum UNumberSignDisplay {
      *
      * @stable ICU 60
      */
-            UNUM_SIGN_ACCOUNTING,
+    UNUM_SIGN_ACCOUNTING,
 
     /**
      * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
@@ -357,7 +360,7 @@ typedef enum UNumberSignDisplay {
      *
      * @stable ICU 60
      */
-            UNUM_SIGN_ACCOUNTING_ALWAYS,
+    UNUM_SIGN_ACCOUNTING_ALWAYS,
 
     /**
      * Show the minus sign on negative numbers and the plus sign on positive numbers. Do not show a
@@ -365,7 +368,7 @@ typedef enum UNumberSignDisplay {
      *
      * @stable ICU 61
      */
-            UNUM_SIGN_EXCEPT_ZERO,
+    UNUM_SIGN_EXCEPT_ZERO,
 
     /**
      * Use the locale-dependent accounting format on negative numbers, and show the plus sign on
@@ -374,14 +377,30 @@ typedef enum UNumberSignDisplay {
      *
      * @stable ICU 61
      */
-            UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+    UNUM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+
+#ifndef U_HIDE_DRAFT_API
+    /**
+     * Same as AUTO, but do not show the sign on negative zero.
+     *
+     * @draft ICU 69
+     */
+    UNUM_SIGN_NEGATIVE,
+
+    /**
+     * Same as ACCOUNTING, but do not show the sign on negative zero.
+     *
+     * @draft ICU 69
+     */
+    UNUM_SIGN_ACCOUNTING_NEGATIVE,
+#endif // U_HIDE_DRAFT_API
 
     /**
      * One more than the highest UNumberSignDisplay value.
      *
      * @internal ICU 60: The numeric value may change over time; see ICU ticket #12420.
      */
-            UNUM_SIGN_COUNT
+    UNUM_SIGN_COUNT = 9,
 } UNumberSignDisplay;
 
 /**
index 04c0754fe0df7b3dd94a5cc9ea6edb6409781238..31b43577112539efdf15d994db8ec0b4d542f97a 100644 (file)
@@ -3782,6 +3782,60 @@ void NumberFormatterApiTest::sign() {
             0,
             u"$0.00");
 
+    assertFormatSingle(
+            u"Sign Negative Positive",
+            u"sign-negative",
+            u"+-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_NEGATIVE),
+            Locale::getEnglish(),
+            444444,
+            u"444,444");
+
+    assertFormatSingle(
+            u"Sign Negative Negative",
+            u"sign-negative",
+            u"+-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_NEGATIVE),
+            Locale::getEnglish(),
+            -444444,
+            u"-444,444");
+
+    assertFormatSingle(
+            u"Sign Negative Negative Zero",
+            u"sign-negative",
+            u"+-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_NEGATIVE),
+            Locale::getEnglish(),
+            -0.0000001,
+            u"0");
+
+    assertFormatSingle(
+            u"Sign Accounting-Negative Positive",
+            u"currency/USD sign-accounting-negative",
+            u"currency/USD ()-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ACCOUNTING_NEGATIVE).unit(USD),
+            Locale::getEnglish(),
+            444444,
+            u"$444,444.00");
+        
+    assertFormatSingle(
+            u"Sign Accounting-Negative Negative",
+            u"currency/USD sign-accounting-negative",
+            u"currency/USD ()-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ACCOUNTING_NEGATIVE).unit(USD),
+            Locale::getEnglish(),
+            -444444,
+            "($444,444.00)");
+
+    assertFormatSingle(
+            u"Sign Accounting-Negative Negative Zero",
+            u"currency/USD sign-accounting-negative",
+            u"currency/USD ()-",
+            NumberFormatter::with().sign(UNumberSignDisplay::UNUM_SIGN_ACCOUNTING_NEGATIVE).unit(USD),
+            Locale::getEnglish(),
+            -0.0000001,
+            u"$0.00");
+
     assertFormatSingle(
             u"Sign Accounting Negative Hidden",
             u"currency/USD unit-width-hidden sign-accounting",
@@ -3871,6 +3925,12 @@ void NumberFormatterApiTest::signNearZero() {
         { UNUM_SIGN_EXCEPT_ZERO, -0.1, u"0" }, // interesting case
         { UNUM_SIGN_EXCEPT_ZERO, -0.9, u"-1" },
         { UNUM_SIGN_EXCEPT_ZERO, -1.1, u"-1" },
+        { UNUM_SIGN_NEGATIVE,  1.1, u"1" },
+        { UNUM_SIGN_NEGATIVE,  0.9, u"1" },
+        { UNUM_SIGN_NEGATIVE,  0.1, u"0" },
+        { UNUM_SIGN_NEGATIVE, -0.1, u"0" }, // interesting case
+        { UNUM_SIGN_NEGATIVE, -0.9, u"-1" },
+        { UNUM_SIGN_NEGATIVE, -1.1, u"-1" },
     };
     for (auto& cas : cases) {
         auto sign = cas.sign;
index 7bf65ae9a691a77fbf2900f9a90aa8aa8dbf5b82..d1001f6ff8172baad18534dd0e6f72b393d304a7 100644 (file)
@@ -529,6 +529,18 @@ public class PatternStringUtils {
                 }
                 break;
 
+            case NEGATIVE:
+            case ACCOUNTING_NEGATIVE:
+                switch (signum) {
+                    case NEG:
+                        return PatternSignType.NEG;
+                    case NEG_ZERO:
+                    case POS_ZERO:
+                    case POS:
+                        return PatternSignType.POS;
+                }
+                break;
+
             case NEVER:
                 return PatternSignType.POS;
 
index 5791e47bc9fd452b966ef4c8ef474f38ea8d7138..d347af81afbcb8dcc0136e294ec02730e7697a4e 100644 (file)
@@ -302,6 +302,9 @@ public final class NumberFormatter {
          * Show the minus sign on negative numbers, and do not show the sign on positive numbers. This is
          * the default behavior.
          *
+         * If using this option, a sign will be displayed on negative zero, including negative numbers
+         * that round to zero. To hide the sign on negative zero, use the NEGATIVE option.
+         *
          * @stable ICU 60
          * @see NumberFormatter
          */
@@ -371,6 +374,22 @@ public final class NumberFormatter {
          * @see NumberFormatter
          */
         ACCOUNTING_EXCEPT_ZERO,
+
+        /**
+         * Same as AUTO, but do not show the sign on negative zero.
+         *
+         * @draft ICU 69
+         * @provisional This API might change or be removed in a future release.
+         */
+        NEGATIVE,
+
+        /**
+         * Same as ACCOUNTING, but do not show the sign on negative zero.
+         *
+         * @draft ICU 69
+         * @provisional This API might change or be removed in a future release.
+         */
+        ACCOUNTING_NEGATIVE,
     }
 
     /**
index 458001bba3ba9a5e3235d42e2e39f44f2af466ee..e7fa6ca7d29d533daa7fc227de3c9858e3425476 100644 (file)
@@ -193,7 +193,8 @@ class NumberFormatterImpl {
         boolean isCompactNotation = (macros.notation instanceof CompactNotation);
         boolean isAccounting = macros.sign == SignDisplay.ACCOUNTING
                 || macros.sign == SignDisplay.ACCOUNTING_ALWAYS
-                || macros.sign == SignDisplay.ACCOUNTING_EXCEPT_ZERO;
+                || macros.sign == SignDisplay.ACCOUNTING_EXCEPT_ZERO
+                || macros.sign == SignDisplay.ACCOUNTING_NEGATIVE;
         Currency currency = isCurrency ? (Currency) macros.unit : DEFAULT_CURRENCY;
         UnitWidth unitWidth = UnitWidth.SHORT;
         if (macros.unitWidth != null) {
index 25411aaf84c48f762bddc1422952503e82cf7013..246abea71701f0c2fb5335a02433c51e5dadf769 100644 (file)
@@ -113,6 +113,8 @@ class NumberSkeletonImpl {
         STEM_SIGN_ACCOUNTING_ALWAYS,
         STEM_SIGN_EXCEPT_ZERO,
         STEM_SIGN_ACCOUNTING_EXCEPT_ZERO,
+        STEM_SIGN_NEGATIVE,
+        STEM_SIGN_ACCOUNTING_NEGATIVE,
         STEM_DECIMAL_AUTO,
         STEM_DECIMAL_ALWAYS,
 
@@ -189,6 +191,8 @@ class NumberSkeletonImpl {
         b.add("sign-accounting-always", StemEnum.STEM_SIGN_ACCOUNTING_ALWAYS.ordinal());
         b.add("sign-except-zero", StemEnum.STEM_SIGN_EXCEPT_ZERO.ordinal());
         b.add("sign-accounting-except-zero", StemEnum.STEM_SIGN_ACCOUNTING_EXCEPT_ZERO.ordinal());
+        b.add("sign-negative", StemEnum.STEM_SIGN_NEGATIVE.ordinal());
+        b.add("sign-accounting-negative", StemEnum.STEM_SIGN_ACCOUNTING_NEGATIVE.ordinal());
         b.add("decimal-auto", StemEnum.STEM_DECIMAL_AUTO.ordinal());
         b.add("decimal-always", StemEnum.STEM_DECIMAL_ALWAYS.ordinal());
 
@@ -217,6 +221,8 @@ class NumberSkeletonImpl {
         b.add("()!", StemEnum.STEM_SIGN_ACCOUNTING_ALWAYS.ordinal());
         b.add("+?", StemEnum.STEM_SIGN_EXCEPT_ZERO.ordinal());
         b.add("()?", StemEnum.STEM_SIGN_ACCOUNTING_EXCEPT_ZERO.ordinal());
+        b.add("+-", StemEnum.STEM_SIGN_NEGATIVE.ordinal());
+        b.add("()-", StemEnum.STEM_SIGN_ACCOUNTING_NEGATIVE.ordinal());
 
         // Build the CharsTrie
         // TODO: Use SLOW or FAST here?
@@ -351,6 +357,10 @@ class NumberSkeletonImpl {
                 return SignDisplay.EXCEPT_ZERO;
             case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
                 return SignDisplay.ACCOUNTING_EXCEPT_ZERO;
+            case STEM_SIGN_NEGATIVE:
+                return SignDisplay.NEGATIVE;
+            case STEM_SIGN_ACCOUNTING_NEGATIVE:
+                return SignDisplay.ACCOUNTING_NEGATIVE;
             default:
                 return null; // for objects, throw; for enums, return null
             }
@@ -478,6 +488,12 @@ class NumberSkeletonImpl {
             case ACCOUNTING_EXCEPT_ZERO:
                 sb.append("sign-accounting-except-zero");
                 break;
+            case NEGATIVE:
+                sb.append("sign-negative");
+                break;
+            case ACCOUNTING_NEGATIVE:
+                sb.append("sign-accounting-negative");
+                break;
             default:
                 throw new AssertionError();
             }
@@ -764,6 +780,8 @@ class NumberSkeletonImpl {
         case STEM_SIGN_ACCOUNTING_ALWAYS:
         case STEM_SIGN_EXCEPT_ZERO:
         case STEM_SIGN_ACCOUNTING_EXCEPT_ZERO:
+        case STEM_SIGN_NEGATIVE:
+        case STEM_SIGN_ACCOUNTING_NEGATIVE:
             checkNull(macros.sign, segment);
             macros.sign = StemToObject.signDisplay(stem);
             return ParseState.STATE_NULL;
@@ -1219,6 +1237,7 @@ class NumberSkeletonImpl {
                     } else if (segment.charAt(offset) == '?') {
                         signDisplay = SignDisplay.EXCEPT_ZERO;
                     } else {
+                        // NOTE: Other sign displays are not included because they aren't useful in this context
                         break block;
                     }
                     offset++;
index 519958e04a9a766f3beb2f710f81a8d88aba0929..a7c68902308edabe0d47a79c104d051b13323dca 100644 (file)
@@ -3573,6 +3573,60 @@ public class NumberFormatterApiTest extends TestFmwk {
                 0,
                 "$0.00");
 
+        assertFormatSingle(
+                "Sign Negative Positive",
+                "sign-negative",
+                "+-",
+                NumberFormatter.with().sign(SignDisplay.NEGATIVE),
+                ULocale.ENGLISH,
+                444444,
+                "444,444");
+        
+        assertFormatSingle(
+                "Sign Negative Negative",
+                "sign-negative",
+                "+-",
+                NumberFormatter.with().sign(SignDisplay.NEGATIVE),
+                ULocale.ENGLISH,
+                -444444,
+                "-444,444");
+        
+        assertFormatSingle(
+                "Sign Negative Negative Zero",
+                "sign-negative",
+                "+-",
+                NumberFormatter.with().sign(SignDisplay.NEGATIVE),
+                ULocale.ENGLISH,
+                -0.0000001,
+                "0");
+        
+        assertFormatSingle(
+                "Sign Accounting-Negative Positive",
+                "currency/USD sign-accounting-negative",
+                "currency/USD ()-",
+                NumberFormatter.with().sign(SignDisplay.ACCOUNTING_NEGATIVE).unit(USD),
+                ULocale.ENGLISH,
+                444444,
+                "$444,444.00");
+        
+        assertFormatSingle(
+                "Sign Accounting-Negative Negative",
+                "currency/USD sign-accounting-negative",
+                "currency/USD ()-",
+                NumberFormatter.with().sign(SignDisplay.ACCOUNTING_NEGATIVE).unit(USD),
+                ULocale.ENGLISH,
+                -444444,
+                "($444,444.00)");
+
+        assertFormatSingle(
+                "Sign Accounting-Negative Negative Zero",
+                "currency/USD sign-accounting-negative",
+                "currency/USD ()-",
+                NumberFormatter.with().sign(SignDisplay.ACCOUNTING_NEGATIVE).unit(USD),
+                ULocale.ENGLISH,
+                -0.0000001,
+                "$0.00");
+
         assertFormatSingle(
                 "Sign Accounting Negative Hidden",
                 "currency/USD unit-width-hidden sign-accounting",
@@ -3643,6 +3697,12 @@ public class NumberFormatterApiTest extends TestFmwk {
             { SignDisplay.EXCEPT_ZERO, -0.1, "0" }, // interesting case
             { SignDisplay.EXCEPT_ZERO, -0.9, "-1" },
             { SignDisplay.EXCEPT_ZERO, -1.1, "-1" },
+            { SignDisplay.NEGATIVE,  1.1, "1" },
+            { SignDisplay.NEGATIVE,  0.9, "1" },
+            { SignDisplay.NEGATIVE,  0.1, "0" },
+            { SignDisplay.NEGATIVE, -0.1, "0" }, // interesting case
+            { SignDisplay.NEGATIVE, -0.9, "-1" },
+            { SignDisplay.NEGATIVE, -1.1, "-1" },
         };
         for (Object[] cas : cases) {
             SignDisplay sign = (SignDisplay) cas[0];