SCROLLX and SCROLLY treat decimal inputs, such as "100.0" as 0.
The bug is that they check that their arguments are numeric, but then get the value as an integer (without any type coersion). As a result, they use whatever the binary format of the double as an integer. For 100.0, this is 0. But for something like PI, it's very different. Since SCROLLX and SCROLLY are really only meaningful for integral numbers, I'd expect an error for decimal numbers that are not integers or possibly rounding to the nearest integer. Certainly, silently treating them as 0 is unexpected.
Steps to Reproduce:
1) Reduce the window size so that there's a horizontal scrollbar.
2) SCROLLX -100.0
What Happens:
The scollbar snaps to the center position.
Exected Result:
Either the scrollbar position moves 100 pixels to the left (like SCROLLX -100) or SCROLLX throws an "doesn't like input" error.
I ran into this when trying to write a procedure to scroll the screen to the turtle's position. This should be simple
But
XCORandYCORoutput floating point numbers, so this bug causes FMSLogo to interpret the position as 0, which makes the secondSCROLLXandSCROLLYcenter the scrollbar. I can work around this bug addingROUND.But I expect that's always what the caller would want, so it might be better to do that within SCROLLX and SCROLLY (that is, they shouldn't throw a "doesn't like" error when given decimal numbers).
I have confirmed that this bug exists in MSWLogo 6.5b, so it's not a regression in FMSLogo.
This is fixed by [r5852]. The fix will be available in FMSLogo 8.3.0.
The fix is to have SCROLLX/SCROLLY round any decimal input, so they can accept XCOR and YCOR.
Related
Commit: [r5852]