EgonOlsen71 / basicv2

A Commodore (CBM) BASIC V2 interpreter/compiler written in Java
https://egonolsen71.github.io/basicv2/
The Unlicense
86 stars 15 forks source link

Interpreter: if condition wrong evaluation #48

Closed viteisele closed 1 year ago

viteisele commented 1 year ago

Test if statement with following code: 100 input a 110 if a then print "true": goto 100 120 print "false": goto 100

With Commodore Basic or with compiler "true" is printed when a is not 0, e. g. a is 1

With Interpreter the behavior is different: here "true" is only printed when a is -1

EgonOlsen71 commented 1 year ago

Should work fine now.

viteisele commented 1 year ago

Better, but there is still a difference between Interpreter and Original/Compiler: When a=0.1 then the Interpreter prints "FALSE", but it should be "TRUE". Does the Interpreter makes an additional conversion to Integer ?

EgonOlsen71 commented 1 year ago

Yes, it did...oops...should be fixed now.

viteisele commented 1 year ago

Perfect :-)

viteisele commented 1 year ago

Now it can be closed