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
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Sun Aug 04, 2002 6:11 pm   

Highest number
 
Is highest number zMUD will return 2.15G (2,150,000,000)? I can't seem to get it to give me anything larger. The process I'm using is as follows:

#if (%1 > 1000000000) {#say %format( 2, %eval( %float( %1) / 1000000000))G}

I know %float isn't available in the current public version, but even still. The highest number without the floating point is 2G (2000000000).

Is there any way to get a higher number?

Fat Tony
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Aug 04, 2002 6:59 pm   
 
#if (%1 > 1000000000) {#say %format( 7, %eval( %float( %1) / 1000000000))G}

Perhaps you should have a look at the %format function. Your limit is self-imposed.

LightBulb
Senior Member
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Sun Aug 04, 2002 7:06 pm   
 
I'm probably just missing something, but even WITHOUT the %format function in there, this is what happens:

#if (12300000000 > 1000000000) {#say %eval( %float( 12300000000) / 1000000000)G}
Displays:
2.14748358726501G

Add a couple zeros, and the result is the same:

#if (123000000000 > 1000000000) {#say %eval( %float( 123000000000) / 1000000000)G}
Displays:
2.14748358726501G

And of course, without the %float, it just returns 2G.

Am I missing something?

Fat Tony
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Sun Aug 04, 2002 7:50 pm   
 
Just to specify, I didn't mean that the LONGEST zMUD will show is to the hundredths place. I mean that zMUD won't return a LARGER number than 2.14748358726501G.

12300000000 / 1000000000 does not equal 2.14G.

Is there a way around that?

Fat Tony
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Aug 04, 2002 8:00 pm   
 
Huge numbers like that I have stored them
in 2 pieces in the past.

# below 999,999 and # >= 1mil.

A couple of functions and voila you have
what you need.

Ton Diening
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Aug 04, 2002 8:17 pm   
 
A while ago I wrote some aliases to overcome the builtin limits of math and zMud. They are for integer use only, and are only meant to overcome the fact that the Delphi library that Zugg uses to write zMud limits the string to integer conversion to a 32bit signed integer.

#ALIAS ADDB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%numitems(@%1);#VAR %1 {%replaceitem(%eval(%number(%item(@%1,@TempBignumber))+%2), @TempBigNumber,@%1)};#WHILE (@TempBigNumber) { #IF (%number(%item(@%1,@TempBigNumber))>1000) {#IF (@TempBigNumber>1) {#VAR %1 {%replaceitem(%eval(%number(%item(@%1, %eval(@TempBigNumber-1)))+%number(%leftback(%item(@%1, @TempBignumber),3))),%eval(@TempBigNumber-1),@%1)};#VAR %1 {%replaceitem(%rightback(%item(@%1,@TempBignumber),3), @TempBigNumber,@%1)}} {#VAR %1 {%replaceitem(%concat(%leftback(%item(@%1,1),3), ":",%rightback(%item(@%1,1),3)),1,@%1)};#VAR %1 {%replace(@%1,":","|")}};#ADD TempBigNumber -1} { TempBigNumber=0}}}
#ALIAS DIVB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%concat(%eval(%number(%item(@%1,1))/%2),"|", %eval(%number(%item(@%1,1))%2),"|1");#WHILE (%item(@TempBigNumber,3)<%numitems(@%1)) {TempBigNumber=%replaceitem(%eval(%number(%item(@TempBigNumber,3))+1), 3,@TempBigNumber);TempBigNumber=%replaceitem(%concat(%item(@TempBigNumber,1), ":", %eval((%number(%item(@%1,%item(@TempBigNumber, 3)))+%eval(1000*%number(%item(@TempBigNumber, 2))))/%2)),1,@TempBigNumber);TempBigNumber=%replaceitem(%mod((%number(%item(@%1, %item(@TempBigNumber,3)))+%eval(1000*%number(%item(@TempBigNumber, 2)))),%2),2,@TempBigNumber)};#VAR %1 {%replace(%item(@TempBigNumber,1),":","|")}}
#ALIAS SHOB {#IF (!%defined("%1")) {#ABORT 1};TempBigNumber="";#FORALL @%1 { TempBigNumber=%concat(@TempBigNumber,%replace(%format("&3.0f",%i)," ","0"))};#WHILE (%left(@TempBigNumber,1)="0") { TempBigNumber=%right(@TempBigNumber,1)};#VAR %1 @TempBigNumber}
Reply with quote
fattony
Apprentice


Joined: 27 Dec 2001
Posts: 105
Location: USA

PostPosted: Sun Aug 04, 2002 8:26 pm   
 
Very cool, I'll give it a try. Thank you for your time and assistance.

Fat Tony
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Aug 05, 2002 4:08 am   
 
Just to clarify, the current version of the %format version is:
quote:
Syntax: %format(f,a,b,c,d...)

use a format string to format the values of a,b,c, etc. Format strings consist of a string of characters, with special format specifiers of the type &w.dx where w is the width of the field, d is the number of decimal places, and x is the format type. Format types for x include: s for string, n for number (commas every 3 digits), f for floating point, m for money (currency).
Since you don't specify a format string anywhere, your use of the %format function is equivalent to the %concat function.

Of course, your use of the %float function makes it obvious you are using the beta version, where the syntax for %format MIGHT be different. This is why questions by beta users should be on the beta forum, namely that a command/function may work differently in the beta version than it does in the public version.

LightBulb
Senior Member
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