Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • Superb, thanks. Now I have to figure out the constants. Commented Jun 26, 2019 at 14:52
  • 1
    I didn't add info on constants because I'm simply not sure and have no way to verify, but I believe that integer constants are stored in memory as 16-bit (signed) integers - not converted to the 40-bit float format. Conversion would only happen if necessary, e.g., if you wrote 10 + 0.0, the 10 would be converted to float for the purposes of the operation. If you attempted to then assign the result to an explicitly integer variable, it would get rounded in some implementations, truncated in others. Commented Jun 26, 2019 at 14:56
  • Ok that's useful Jeff. May I beg one more test? What if you do A=0.5, I%=I%+A? Is that allowed, and if so, what is the result? I guess I just need a DOS box... Commented Jun 26, 2019 at 16:37
  • 1
    It will do the calculation in float, and then convert the result back to integer. As above, some implementations will truncate before conversion back to integer, others will round - and there's always the question of which way a rounding implementation rounds. GW-BASIC appears to round up for 0.5, and this overflows. Commented Jun 26, 2019 at 16:43