• Join/Login
  • Business Software
  • Open Source Software
  • For Vendors
  • Blog
  • About
  • More
    • Articles
    • Create
    • SourceForge Podcast
    • Site Documentation
    • Subscribe to our Newsletter
    • Support Request
SourceForge logo
For Vendors Help Create Join Login
SourceForge logo
Business Software
Open Source Software
SourceForge Podcast
Resources
  • Articles
  • Case Studies
  • Blog
Menu
  • Help
  • Create
  • Join
  • Login
  • Home
  • Browse
  • FMSLogo
  • Bugs
FMSLogo

SCROLLX/SCROLLY incorrectly handle decimals

A Logo programming environment for Microsoft Windows

Brought to you by: david_costanzo
  • Summary
  • Files
  • Reviews
  • Support
  • Tickets ▾
    • Feature Requests
    • Bugs
    • Support Requests
  • Discussion
  • Code
Menu ▾ ▴
  • Create Ticket
  • View Stats

Group

  • v_6.06x
  • v_6.07.X
  • v_6.08.X
  • v_6.10.X
  • v_6.11.X
  • v_6.13.X
  • v_6.22.X
  • v_6.25.X
  • v_6.26.X
  • v_6.27.X
  • v_6.28.X
  • v_6.29.X

Searches

  • Changes
  • Closed Tickets
  • Open Tickets

Help

  • Formatting Help

#475 SCROLLX/SCROLLY incorrectly handle decimals

v_6.06x
closed-fixed
David Costanzo
None
5
2021-12-27
2016-06-26
David Costanzo
No

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.

Discussion

  • David Costanzo

    David Costanzo - 2021-12-25
    • assigned_to: David Costanzo
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2021-12-25

    I ran into this when trying to write a procedure to scroll the screen to the turtle's position. This should be simple

    ::text
    TO FINDTURTLE
       SCROLLX 0      ; center the horizontal scrollbar
       SCROLLY 0      ; center the vertical scrollbar
       SCROLLX  XCOR  ; scroll the distance from the center to turtle's x coordinate
       SCROLLY  -YCOR ; scroll the distance from the center to turtle's y coordinate
    END
    

    But XCOR and YCOR output floating point numbers, so this bug causes FMSLogo to interpret the position as 0, which makes the second SCROLLX and SCROLLY center the scrollbar. I can work around this bug adding ROUND.

    :::text
    TO FINDTURTLE
       SCROLLX 0           ; center the horizontal scrollbar
       SCROLLY 0           ; center the vertical scrollbar
       SCROLLX ROUND XCOR  ; scroll the distance from the center to turtle's x coordinate
       SCROLLY ROUND -YCOR ; scroll the distance from the center to turtle's y coordinate
    END
    

    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.

     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2021-12-27
    • status: open --> closed-fixed
     
    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
  • David Costanzo

    David Costanzo - 2021-12-27

    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]

    If you would like to refer to this comment somewhere else in this project, copy and paste the following link:

Log in to post a comment.

SourceForge
  • Create a Project
  • Open Source Software
  • Business Software
  • Top Downloaded Projects
Company
  • About
  • Team
  • SourceForge Headquarters
    1320 Columbia Street Suite 310
    San Diego, CA 92101
    +1 (858) 422-6466
Resources
  • Support
  • Site Documentation
  • Site Status
  • SourceForge Reviews
SourceForge logo
© 2026 Slashdot Media. All Rights Reserved.
Terms Privacy Opt Out Advertise
mdb logo