Script to format a currency value
Peter Haworth
pete at mollysrevenge.com
Tue Mar 1 12:16:56 EST 2011
Hi Sarah,
Sorry for the confusion, bad terminology! You're right when you say it's just the currency value stored without the decimal point (although the number of implied decimal points is part of the formatting spec, not fixed at 2).
I'll come up with some test cases today and send them in a separate email.
Pete Haworth
On Mar 1, 2011, at 2:14 AM, Sarah Reichelt wrote:
> On Tue, Mar 1, 2011 at 2:55 PM, Peter Haworth <pete at mollysrevenge.com> wrote:
>> OK, here's an amusing exercise in scripting for you experts out there, but I'm giving away a prize! I will give the person who provides the best solution a copy of my band's latest CD, Aged 10 years. the definition of "best" is strictly my opinion! If you don;t like traditional Celtic music (including bagpipes), we;ll just do the script for the fun of it and sell the CD on eBay!!!
>>
>> You have an integer value that needs to be formatted into a currency value. It is stored as a positive or negative binary value no matter how many decimal places it has (eg 10000 = $100.00). You have the following formatting characters to deal with:
>
>
> Sounds like a fun challenge Pete, but this bit has me confused.
> You say the numbers are stored as binary, but I don't see how 10000
> binary gets to $100.00
> 10000 binary = 16 decimal
> So I am assuming that it isn't actually binary, just the currency to 2
> decimal places, only without the decimal point.
>
> Also, can you provide some test cases showing what you want to get
> back for a given set of parameters?
>
> Cheers,
> Sarah
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list