wrangle error with divide "/"?

   4135   3   1
User Avatar
Member
37 posts
Joined: Aug. 2012
Offline
is wrangle working with division in float?

when i tried

f@result = @ptnum / (@numpt-1);

it supposed to give me gradual float values from 0~1 but it didn't. everything returns 0 except the last value with 1. it works as if floor() has been applied.

anything wrong i did?

hb

Attachments:
Screen Shot 2016-06-16 at 1.51.56 PM.png (270.4 KB)

User Avatar
Member
4189 posts
Joined: June 2012
Offline
try

@numpt_ = (@numpt-1);
@result = @ptnum /@numpt_;
User Avatar
Member
1743 posts
Joined: May 2006
Offline
I don't think setting the variable type implicitly casts the terms of the expression.

I always explicitly cast the second term of the division:

@u = @ptnum / float(@numpt);

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
37 posts
Joined: Aug. 2012
Offline
both are working fine.

thanks everyone!

hb
  • Quick Links