|
fattony Apprentice
Joined: 27 Dec 2001 Posts: 105 Location: USA
|
Posted: Sun Aug 04, 2002 8:25 pm
Dividing Long Numbers |
My recent topic was related to this, but it is different enough that I'm posting it in a new one.
I can't think of a good way to describe this problem, so I'll just give it a try and hope someone can make sense of it. Basically, I need to convert a long number (1,000,000 for example) into its smaller format (like 1M or 1.00M). I have the basic %format(2,1000000) stuff done, I'm well past that.
I made an alias (calling it 'denomination' for lack of a better term) that looks like this:
#alias denomination {%if( %format( 0, %1) >= 1000000000, %format( 2, %eval( %float( %1) / 1000000000))G)%if( %format( 0, %1) >= 1000000 AND %format( 0, %1) < 1000000000, %format( 2, %eval( %float( %1) / 1000000))M)%if( %format( 0, %1) >= 1000 AND %format( 0, %1) < 1000000, %format( 0, %eval( %float( %1) / 1000))K)%if( %format( 0, %1) < 1000, %1)}
And that WORKS, except I need to be able to use it in a variable, like this:
#var test {denomination 1000000}
I've tried many different tweaks to guess and check it, but no dice. I've tried using the #fu command and doing #var test {@denomination 1000000) but that didn't work either.
Any ideas?
Fat Tony |
|
|
|
Kjata GURU
Joined: 10 Oct 2000 Posts: 4379 Location: USA
|
Posted: Sun Aug 04, 2002 8:39 pm |
The way to pass arguments to a function is by enclosing it in parenthesis:
#VAR test {@denomination(1000000)}
Kjata |
|
|
|
fattony Apprentice
Joined: 27 Dec 2001 Posts: 105 Location: USA
|
Posted: Sun Aug 04, 2002 8:42 pm |
Works perfectly, I knew it had to be something simple I was overlooking. Thank you for your time.
Fat Tony |
|
|
|
|
|
|
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
|
|