Message 1 of 6
Maya isnt completing a simple loop??!!

Not applicable
11-26-2007
04:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
hy guys and girl,
i hope this is the right place to post my problem.
i scripted a simple loop to put a certain range of numbers into an array. but maya is just not completing the whole loop. i dont get it why it behaves like that.
by the way im running "Autodesk® Maya®, Version 8.5 x64" .
here is the script :
global proc test()
{
float $variable_01 ;
float $myArray01[] ;
$variable_01 = 0.4 ;
float $x;
int $i = 0 ;
for($x = (-1.0) ; $x <= 1 ; $x+= 0.1)
{
$myArray01 = $variable_01 + $x ;
$i++ ;
}
;
print $myArray01;
print (size($myArray01)+"\n") ;
}
test();
if you c+p this to maya and run it, it'll give you the whole array plus the information about how many numbers are in the array (200). but there should be 201 values (200 values + "0"). the last value given is 1.39 . the first value in the array and all the other that follow are just as expected and correct, but somehow maya doesnt run the loop till the end.
If you strip away one zero from the iteration
for($x = (-1.0) ; $x <= 1 ; $x+= 0.01)
to
for($x = (-1.0) ; $x <= 1 ; $x+= 0.1)
and run the script again, you dont get that problem.
the loop runs correctly an gives you back 21 values and as the last value 1.4.
otherwise if you take the iteration to an even lower level e.g. "0.001" it produces the same problem.
why does this happen? maya-internal-rounding-bug?
i would be very gratefull if somebody could explain to me why that is happening.
is it a known problem?
greetz
stefan
i hope this is the right place to post my problem.
i scripted a simple loop to put a certain range of numbers into an array. but maya is just not completing the whole loop. i dont get it why it behaves like that.
by the way im running "Autodesk® Maya®, Version 8.5 x64" .
here is the script :
global proc test()
{
float $variable_01 ;
float $myArray01[] ;
$variable_01 = 0.4 ;
float $x;
int $i = 0 ;
for($x = (-1.0) ; $x <= 1 ; $x+= 0.1)
{
$myArray01 = $variable_01 + $x ;
$i++ ;
}
;
print $myArray01;
print (size($myArray01)+"\n") ;
}
test();
if you c+p this to maya and run it, it'll give you the whole array plus the information about how many numbers are in the array (200). but there should be 201 values (200 values + "0"). the last value given is 1.39 . the first value in the array and all the other that follow are just as expected and correct, but somehow maya doesnt run the loop till the end.
If you strip away one zero from the iteration
for($x = (-1.0) ; $x <= 1 ; $x+= 0.01)
to
for($x = (-1.0) ; $x <= 1 ; $x+= 0.1)
and run the script again, you dont get that problem.
the loop runs correctly an gives you back 21 values and as the last value 1.4.
otherwise if you take the iteration to an even lower level e.g. "0.001" it produces the same problem.
why does this happen? maya-internal-rounding-bug?
i would be very gratefull if somebody could explain to me why that is happening.
is it a known problem?
greetz
stefan