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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Gilbert
Beginner


Joined: 10 Oct 2000
Posts: 11
Location: Germany

PostPosted: Fri Dec 28, 2001 6:33 pm   

Want to have float...
 
Hi,
it's possible to get a float and not a integer ?
i.e.
#math bla (3 / 2) = 2 (but i want to have 1.5)

greetings
Christian
Reply with quote
Acaila
Apprentice


Joined: 30 Aug 2001
Posts: 187
Location: Netherlands

PostPosted: Fri Dec 28, 2001 7:16 pm   
 
The new beta version of zMUD (v6.24) supports floating point mathematics, earlier versions like 6.16 don't. Some people have created a few ways around this using more complicated calculations, but I can't remember what it was exactly.

Acaila
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 867
Location: USA

PostPosted: Fri Dec 28, 2001 10:07 pm   
 
For most applications, the workaround is assumed decimal points. Say you want to know the answer to 3 figures- multiply by 1000 before doing the division:

3/2 = (3000 / 2) (/1000) = 1500 (/1000)

You never perform the implicit division (/1000) at the end, you just 'keep it in mind' when figuring out what acceptable values are or doing more math on the result.

I think the most commonly seen application used to be representing numbers as percents- 2/3 doesn't give 66.6% using integer math, so you do 2000/3 = 666 and keep in mind that that's really 66.6%.

-Tarn
Reply with quote
Gilbert
Beginner


Joined: 10 Oct 2000
Posts: 11
Location: Germany

PostPosted: Fri Dec 28, 2001 10:41 pm   
 
Hi,
i think the float() in 6.24 doesn't work....

#sh %float(3) -> Result: 3.0
#sh %float(3.1) -> Result: Error-Window 'Message '3.1'is not a valid floating point value'

#sh %float(3,1) -> Result: 3.0

#sh %isfloat(3) -> Result: 0
#sh %isfloat(3,1) -> Result: 0
#sh %isfloat(3.1) -> Result: Error-Window 'Message '3.1'is not a valid floating point value'


I want to get a percent-value like:
(exp * 100 / exp_for_next_level) = %

But i want (i wish for next year *ggggg*) to get a value like 34.12% ;)

greetings
Christian
PS: sorry for my bad english :(
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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