Joker386 Posted March 10, 2012 Share Posted March 10, 2012 hi I created a custom Float Parameter from Parameter Interface . when I set this parameter to (0.1) , the actual value is (0.100000001) why ? how can I fix it ? Quote Link to comment Share on other sites More sharing options...
edward Posted March 10, 2012 Share Posted March 10, 2012 Make sure you're looking at the parameter in value mode. The name of the parameter should NOT have a dark background. Quote Link to comment Share on other sites More sharing options...
gaurav Posted March 11, 2012 Share Posted March 11, 2012 when I set this parameter to (0.1) , the actual value is (0.100000001) why ? This is due to the nature of binary floating point representation. More on it here. http://docs.python.org/tutorial/floatingpoint.html Edward already mentioned the value mode toggle. Cheers, Quote Link to comment Share on other sites More sharing options...
Joker386 Posted March 11, 2012 Author Share Posted March 11, 2012 thanks my friends so how can I fix it ? for example i want create a counter attribute. I created a attribute for particles by name "count" I add a custom parameter by name "Steps" and set it to 0.1 (but in natural it's equal to 0.100000001) I write below expression for attribute's value : { if($FF < 10 ) { a = $COUNT + ch("steps") ; return a; } else { if ($COUNT > 0 ) { a = $COUNT - ch("steps") ; return $COUNT ; } } } but I have problem here ! when $COUNT = 0.1 then in the next step $COUNT = 1.49012e-008 and in the next step $COUNT = -0.1 and in the next step it equal to 0 ? if I replace number 0.1 instead ch("steps") in the expression , every things are OK ,why ?! I attach my sample Project , select attribute_Counter in the popnet1 and open Spreadsheet and check count value ! Quote Link to comment Share on other sites More sharing options...
Joker386 Posted March 11, 2012 Author Share Posted March 11, 2012 Sample Project : CountGeo.hip Quote Link to comment Share on other sites More sharing options...
gaurav Posted March 12, 2012 Share Posted March 12, 2012 Make it int. Counter and steps should both be integer type. Cheers, Quote Link to comment Share on other sites More sharing options...
Joker386 Posted March 15, 2012 Author Share Posted March 15, 2012 Thanks Quote Link to comment Share on other sites More sharing options...
magneto Posted March 15, 2012 Share Posted March 15, 2012 Make sure you're looking at the parameter in value mode. The name of the parameter should NOT have a dark background. This only works for the light color theme Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.