Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: 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.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: 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."
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net