Formatting functions fail randomly for a same expression

Issue #628 closed
Tey' created an issue
  1. Enter hex(1e10000)
  2. The result is 0x9,B84EA28556BF2697F(+0d8304)
  3. Enter hex(1e10000) again
  4. The result is NaN
  5. Enter hex(1e10000) again
  6. The result is 0x9,B84EA28556BF2697F(+0d8304) again

It also happens with bin and oct. It does work correctly with other numbers though (hex(1e100) for instance), but I remember I've seen this behavior before with other numbers as well.

Also:

#!

hex(1e1000)
= 0x3,CE36C7E774F6B015E(+0d830)

hex(2)
= NaN

hex(2)
= 0x2

hex(2)
= 0x2

This seems to indicate some state is not reset after processing the first expression, which makes the second expression fail.

Comments (7)

  1. Tey' reporter

    Yes, and ans is not set to NaN but to the correct value.

    The problem is related to the formatting method (float_out() called from _doFormat()) which sets an error which is never checked so never cleared. The error is then checked later when formatting the next result which produces the NaN.

  2. Log in to comment