Uploaded image for project: 'ICU'
  1. ICU-13156

ArithmeticException thrown in CompactDecimalFormat

    Details

    • tracOwner:
      shane
    • tracProject:
      all
    • tracReporter:
      shane
    • tracResolution:
      fixed
    • tracReviewer:
      andy
    • tracStatus:
      closed

      Description

      It happens when you try to format a small fraction with a CompactDecimalFormat, which is apparently not something we cover in our test suite. Reproducible test case:

      ULocale loc = ULocale.ENGLISH;
      CompactDecimalFormat cdf = CompactDecimalFormat.getInstance(loc, CompactStyle.SHORT);
      cdf.setMaximumFractionDigits(1);
      String result = cdf.format(0.01);
      assertEquals("Should not throw exception on small number", "0", result);
      

      I'm working on a patch. It would be good to get this one into the maintenance branch.

        Attachments

          Activity

            People

            • Assignee:
              shane Shane Carr
              Reporter:
              shane Shane Carr
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                tracCreated: