|
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: Fri Dec 22, 2006 4:08 am
Large Number Denominations |
I have an old defined variable that I use to alter other variables that contain long numbers, to break them down in to sections, like this:
@bank_denom(@somenumber)
1970235 becomes 1M 970K, and ignores the last three digits.
The variable is called "bank_denom", and its value is this:
Code: |
%if( %format( 0, %1) >= 10000000, %format( 0, %eval( %1 / 1000000))M %eval( %eval( %1 - (%left( %1, 2) * 1000000)) / 1000)K, "")%if( %format( 0, %1) >= 1000000 AND %format( 0, %1) < 10000000, %format( 0, %eval( %1 / 1000000))M %eval( %eval( %1 - (%left( %1, 1) * 1000000)) / 1000)K)%if( %format( 0, %1) < 1000000, %eval( %1 / 1000)K) |
I am attempting to convert it to allow for even larger numbers, up to multiple G's. I would like to be able to convert:
1970235493 in to 1G 970M 235K, and ignore the last three,
but I am having trouble doing so. It's been years since I made the above variable and I can't remember exactly how I did it. Any help would certainly be appreciated, and I'll be glad to reciprocate in any way I can.
P.S. - I lost my old forum login and password - I didn't have a whole lot of posts (somewhere in the 50's I think), but I watch this forum constantly and helped where I could. |
|
|
|
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: Fri Dec 22, 2006 4:59 am |
Nevermind, kind of figured it out - zMUD is unable to handle numbers this large. I read somewhere that CMUD doesn't have this limitation, is that correct? Planned to buy it anyway, but my settings won't import properly, get constantly bug/error messages asking me to close the program.
|
|
|
|
Full Throttle Wanderer
Joined: 07 Dec 2004 Posts: 65
|
Posted: Fri Dec 22, 2006 8:31 am |
"zMUD is unable to handle numbers this large"
think of your input as a string not a number
#function unit_fn {@unit_fn_format(%concat(%repeat("0",%eval(16-%len(%1))),%1))}
#function unit_fn_format {%number(%copy(%1,1,1))p %number(%copy(%1,2,3))t %number(%copy(%1,5,3))g %number(%copy(%1,8,3))m %number(%copy(%1,11,3))k}
#echo @unit_fn(1234567890123456)
#echo @unit_fn(123456789012345)
#echo @unit_fn(12345678901234)
#echo @unit_fn(1234567890123)
#echo @unit_fn(123456789012)
#echo @unit_fn(12345678901)
#echo @unit_fn(1234567890)
#echo @unit_fn(123456789)
#echo @unit_fn(12345678)
#echo @unit_fn(1234567)
#echo @unit_fn(123456)
#echo @unit_fn(12345)
#echo @unit_fn(1234)
#echo @unit_fn(123)
1p 234t 567g 890m 123k
0p 123t 456g 789m 12k
0p 12t 345g 678m 901k
0p 1t 234g 567m 890k
0p 0t 123g 456m 789k
0p 0t 12g 345m 678k
0p 0t 1g 234m 567k
0p 0t 0g 123m 456k
0p 0t 0g 12m 345k
0p 0t 0g 1m 234k
0p 0t 0g 0m 123k
0p 0t 0g 0m 12k
0p 0t 0g 0m 1k
0p 0t 0g 0m 0k
where
k ~ 1,000
m ~ 1,000,000
g ~ 1,000,000,000
t ~ 1,000,000,000,000
p ~ 1,000,000,000,000,000 |
|
|
|
|
|
|
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
|
|