SETACTIVEAREA doesn't throw errors on non-integer values
A Logo programming environment for Microsoft Windows
Brought to you by:
david_costanzo
SETACTIVEAREA's documentation says that all members of its input list must be integers. However, SETACTIVEAREA does not throw a bad input error when the member is a floating point value. Instead, it silently truncates the floating point value (rounds down) and accepts it.
How Reproducible:
Every Time
Steps to Reproduce:
SETACTIVEAREA [0 0 200.5 200]
What Happens:
The active area changes to [0 0 200 200]
Expected Result:
SETACTIVEAREA doesn't like [0 0 200.5 200] as input.
why not just round then numbers and be done with it.
Diff:
I have committed a fix for this. It will be available in FMSLogo 7.0. The fix also covers very large integers that cannot be represented by FMSLogo (such as 1e100).
To finally answer the question that was asked 7 years ago, the main reason I didn't just round the number is because then FMSLogo would be taking away a learning opportunity and making a decision for the programmer without their knowledge.
The learning opportunity is to understand that raster operations like BITSAVE work on pixels, not turtle steps, and that pixels are discrete. By masking the programming mistake, the programmer is never informed of their misunderstanding.
In this case, automatically rounding was as difficult to implement within FMSLogo as throwing an error. But for a Logo programmer, it would be easy to fix whatever typo they made, or perhaps add ROUND, INT, FLOOR, or CEILING, depending on what they want.