Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk 3ds® Max® / MaxScript / Dividing 1 with 100 is 0 why?
  RSS 2.0 ATOM  

Dividing 1 with 100 is 0 why?
Rate this thread
 
64245
 
Permlink of this thread  
avatar
  • larex
  • Posted: 07 February 2012 05:34 AM
  • Total Posts: 3
  • Joined: 29 October 2008 06:13 PM

I have strange behaviour with maxcsript, when i want divide 1/100 he says that it is 0 do you know whre is the problem?



Replies: 4
/userdata/avatar/baadwq4zg_robot_100.jpg

1.0 / 100.0

Author: jona vark

Replied: 08 February 2012 03:16 AM  
/userdata/avatar/345m67gtb.png

still ZERO…
1.00/100.00 = 0.01

Author: Doughboy12

Replied: 08 February 2012 03:30 AM  
/userdata/avatar/baadwq4zg_robot_100.jpg

how is that zero? :)

Author: jona vark

Replied: 08 February 2012 07:51 AM  
/userdata/avatar/345m67gtb.png

I am assuming the float only “floats” to the decmal places you give it...IDK you could be correct though.

Author: Doughboy12

Replied: 08 February 2012 08:04 AM  
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14380
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Nothing strange about that at all. Working exactly as expected.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Attachment Attachment
Replies: 0
avatar
  • Location: West Midlands, England, UK
  • Total Posts: 14380
  • Joined: 06 August 2007 11:06 PM
  • Permlink of this post

Guys, this IS working exactly as the help says it will.

If BOTH operands are integer, the result is integer.
If EITHER (or both) are float, the result is float.
The number of decimal places is the smallest number of places capable of displaying the result (up to a point, after which you’ll get a “scientific notation” result).

You could always force the number of decimals by using formattedPrint, though unless you’re trying to create fixed-width tabulated results it’s not going to be particularly useful.



Max 4.2 through 2013.
XP-64 (SP2)
NVidia 9800GTX-512 (Driver 266.58).
Core 2 Quad Q6600 2.4GHz, 8Gb Ram, DX9.0c.

Attachment Attachment
Replies: 0