Opened 8 years ago

Closed 8 years ago

Last modified 8 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

Description

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 8 years ago.
0001-cast-ints-as-floats-when-passing-args-to-Python-bloc.patch (970 bytes) - added by walter 8 years ago.

Download all attachments as: .zip

Change History (7)

Changed 8 years ago by tonyforster

comment:1 Changed 8 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 8 years ago by tonyforster

Ok

comment:3 Changed 8 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 8 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 8 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.