paladin-t / my_basic

A lightweight BASIC interpreter written in standard C in dual files. Aims to be embeddable, extendable and portable.
http://paladin-t.github.io/my_basic/
MIT License
508 stars 118 forks source link

Posative (with sign) exponents not supported in REAL constants #50

Closed nurbles closed 2 years ago

nurbles commented 2 years ago

I believe that condition on line 5883 of my_basic.c should end with (c == '-' || c == '+') instead of just c == '-' when checking for an exponent sign. With the original code, a statement like

   x = 1.23E+07

produces an error. With the proposed change, the constant is correctly interpreted. I'm not familiar enough with the code to be certain that there are no unexpected effects though, so I'm suggesting the change this way.

[EDIT: I originally and incorrectly used negative, when I mean positive. Sorry.]

paladin-t commented 2 years ago

Fixed.

Thanks!