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
  • Having said all that, I kinda get why Monkey C does this. It's probably because an assumption is made that you're going to output stuff to a tiny screen (like the screen of a watch), so in that case it makes sense to only display a limited number of decimals.

    It doesn't make sense for stuff that's logged to the console, though.

Comment
  • Having said all that, I kinda get why Monkey C does this. It's probably because an assumption is made that you're going to output stuff to a tiny screen (like the screen of a watch), so in that case it makes sense to only display a limited number of decimals.

    It doesn't make sense for stuff that's logged to the console, though.

Children
No Data