jscience
  1. jscience
  2. JSCIENCE-168

AmountFormat does not return correct value when using getExactDigitsInstance

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: current
    • Fix Version/s: None
    • Component/s: Mathematics
    • Labels:
      None

      Description

      The following works:
      System.out.println(Amount.valueOf(0.001, (NonSI.LITER)).to(SI.MILLI(NonSI.LITER)));

      Returns (0.9999999999999998 ± 1.7E-16) mL (Or effectively, 1mL)

      The following doesn't work correctly:

      AmountFormat.setInstance(AmountFormat.getExactDigitsInstance());
      System.out.println(Amount.valueOf(0.001, (NonSI.LITER)).to(SI.MILLI(NonSI.LITER)));
      Returns 0.100000000000000 mL

      This may be related to JSCIENCE-138

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            jazeee
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: