toString(16) crashes with huge negative number

Posted on
  • Hi

    I was trying to dump out onewire IDs in Hex. I took the device ID
    from ow.search and called toString(16). I think this caused Espurino
    to crash.... the device ID was a huge negative number when normally
    printed.

    Sorry for not quoting the number itself.

    Martin

    P.S. Where should I post bug reports if not here?

  • Hi. Thanks for letting me know... It's best to post on the issue tracker: http://www.github.com/espruino/Espruino/­issues

    Do you want to do it - or I can.

    (-1000000000000000000).toString(16) // works
    (-10000000000000000000).toString(16) // crashes
    (8446744073709551616).toString(16) // crashes
    

    Interestingly this appears to be the point at which the number rolls over and becomes positive - so it's large numbers rather than just negatives.

  • Ok, fixed now - it'll be in 1v61

  • Thanks - I guess that means I don't have to post it as an issue :)

  • Nope, that's fine ;)

    Next release should be a good one - there are over 15 fixes in it now - and counting :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

toString(16) crashes with huge negative number

Posted by Avatar for mgg1010 @mgg1010

Actions