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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: Sat Nov 14, 2009 7:25 pm   

The use of %float
 
Hey all

How are we supposed to do calculation in this software with numbers that are not integers?

I wonder if the syntaxing when calculating can be made more user-friendly.

E.g:
If I want to display the result of 10/3, the intuition in CMUD is to use

[/code]
#SHOW (10/3)
Code:

and expect 3.333333333333 to be the answer... But what I get is 3.

In order to get the expected answer... one has to use:

#SHOW (%float(10)/%float(3))
Code:


This is very clumsy imo...

To sum it up... can CMUD be made to use floating numbers as standard? Or is there a reason that it is the way it is? Like... being faster for internal operations?

//D
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Nov 14, 2009 7:30 pm   
 
This has always been the case, even in zMUD. Most people playing MUDs do not need floating point math and integer math is much much faster. It's easy to do floating point...just add the decimal to any number. For example:

#SHOW (10.0/3.0)

will show the 3.3333 that you expect. CMUD is NEVER going to use floating point math by default.
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: Sat Nov 14, 2009 7:33 pm   
 
oh, handy... thanks :)
Reply with quote
orphean
Apprentice


Joined: 21 Oct 2008
Posts: 147
Location: Olympia, WA

PostPosted: Sat Nov 14, 2009 7:39 pm   
 
Edit: Beaten by Zugg!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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