![](templates/Classic/images/spacer.gif) |
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Thu Apr 24, 2008 3:13 am
[2.18] Bug with #FOR and #loop |
#FORA 1|2|3|4 {$test=%abs(%eval(%i-4.2));#show $test}
#FORA 1|2|3|4 {$test=%eval(%i-4.2);#show $test}
#loop 1,4 {$test=%abs(%eval(%i-4.2));#show $test}
The %abs function is stripping the decimals. Found this trying to write a stdev function. |
|
|
![](templates/Classic/images/spacer.gif) |
Dharkael Enchanter
![](images/avatars/9583916094231d31d8f24f.png)
Joined: 05 Mar 2003 Posts: 593 Location: Canada
|
Posted: Thu Apr 24, 2008 5:03 am |
To avoid this cast the value being passed into %abs as a float.
Code: |
#FORA 1|2|3|4 {$test=%abs(%float(%eval(%i-4.2)));#show $test} |
|
|
_________________ -Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style." |
|
|
![](templates/Classic/images/spacer.gif) |
|
|