DavidKinder / Git

Fast Glulx interpreter, originally written by Iain Merrick.
MIT License
46 stars 13 forks source link

@streamnum fails for smallest negative number #8

Closed DavidKinder closed 7 years ago

DavidKinder commented 7 years ago

See www.intfiction.org/forum/viewtopic.php?t=20768

The problem is in the code at "resume_number_L7_digit_L6": this converts the number to be printed to a positive value:

L1 = (L7 < 0) ? -L7 : L7; // Absolute value of number.

But since L1 is a signed 32-bit variable, this won't work for -2147483648, as +2147483648 can't be represented as a signed 32-bit value.

DavidKinder commented 7 years ago

Fixed by https://github.com/DavidKinder/Git/commit/427d52c2898d07917eedac01049ed7732e13c448

erkyrath commented 7 years ago

I've updated the Glulxercise test (http://eblong.com/zarf/glulx/glulxercise.ulx) to test this case.