Floating point overflow
RonLinu opened this issue · 3 comments
RonLinu commented
Hello Stefan!
I guess you probably know about this but here it is: TinyBASIC locks up when handling a number bigger than 1e38.
print 1e39
x = 1e39
will lock up the interpreter.
I admit this does not occur often, mostly because of a programming error.
On the other hand, underflow is handled correctly as it returns 'zero' which is ok.
Tested on an Arduino Mega 2560
slviajero commented
will look into this soon. i rewrote the number code anyway
…Sent from my iPhone
On Dec 5, 2022, at 10:24 PM, RonLinu ***@***.***> wrote:
Hello Stefan!
I guess you probably know about this but here it is: TinyBASIC locks up when handling a number bigger than 1e38.
print 1e39
x = 1e39
will lock up the interpreter.
I admit this does not occur often, mostly because of a programming error.
On the other hand, underflow is handled correctly as it returns 'zero' which is ok.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
slviajero commented
Checked in new code in the TinybasicArduino folder of the repo that fixes the problem. Origin is mishandling of inf. The code I checked in is portable to gcc variants. Will ceck portability.
slviajero commented
Fixed now in the main code and tested against the main platforms. Handle inf and nan.