Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#4382 closed defect (notabug)

mousex mousey do integer math

Reported by: tonyforster Owned by: walter
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Turtleart Version: Unspecified
Severity: Unspecified Keywords:
Cc: Distribution/OS: Unspecified
Bug Status: Unconfirmed


print python-function(y/x, mousex, mousey)
returns 0,1,2 etc

Attachments (2)

Screenshot of %22Turtle Art Activity%22 mousey.png (137.9 KB) - added by tonyforster 11 years ago.
0001-cast-ints-as-floats-when-passing-args-to-Python-bloc.patch (970 bytes) - added by walter 11 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 11 years ago by walter

  • Resolution set to notabug
  • Status changed from new to closed

Not sure what the bug is here. mousex and mousey are ints, so in Python, you'll get an int when you divide. If you add flt(y)/x you get a fractional value. What are you expecting?

comment:2 Changed 11 years ago by tonyforster


comment:3 Changed 11 years ago by walter

If you think it would be better to generate these points as float, I can do it. A bit on the fence.

comment:4 Changed 11 years ago by tonyforster

I presume the turtle division operator casts them as float. So the issue was my python skills. I suppose lots of other stuff is int too? Xpos? Screen width? Colour? Cast all python input as float?

comment:5 Changed 11 years ago by walter

Let's try it and see what breaks. I'll attach a patch.

Note: See TracTickets for help on using tickets.