Ticket Created
over 3 years ago

CIQQA-1396

Bug: Print doubles with full precision to prevent weird behaviour by test messages.

    (:test)
    function garminDouble(logger) {
      var mile = 0.6213711922d;
      var km = 21.0975;

      var hm = mile * km;

      Test.assertEqualMessage(hm, 13.109379d,
        Lang.format("half marathon in miles $1$ equals to $2$",
          [ hm, 13.109379d ]));
    }

The following code fails with: Exception: ASSERTION FAILED: half marathon in miles 13.109379 equals to 13.109379

Please make sure that the printed version equals what the actual test uses for the precision of the double. As soon as you toString() the values, it becomes the same value. Which is unclear and very confusing.

Parents
  • "The real question is what should be expected when a double is printed out "directly", using Lang.format or System.println."

    Or to be more precise, "what should be expected when you call Float.toString() or Double.toString()?"

    Seems that in most languages, you get all the decimal places, but not in Monkey C.

Comment
  • "The real question is what should be expected when a double is printed out "directly", using Lang.format or System.println."

    Or to be more precise, "what should be expected when you call Float.toString() or Double.toString()?"

    Seems that in most languages, you get all the decimal places, but not in Monkey C.

Children
No Data