Re: Currency Numbers
Re: Currency Numbers
- Subject: Re: Currency Numbers
- From: "Nigel Garvey" <email@hidden>
- Date: Thu, 22 Jun 2006 03:10:05 +0100
kai wrote on Thu, 22 Jun 2006 00:35:28 +0100:
>On 21 Jun 2006, at 21:01, Nigel Garvey wrote:
>> Interestingly, although multiplying an integer by itself is nearly
>> twice
>> as fast as squaring it (!), the effect was for some reason almost
>> exactly cancelled out by the two tells in my script. :-\
>And with a little shuffling, we can take advantage of
>both a multiplication and a single tell:
>
>------------------
>
>on currency_format for v
> tell (v mod 1 as text) * 100 to (v div 1 as text) & (0.0 as text)'s
>character 2 & ((it * it) ^ 0.5 + 0.5) div 1
>end currency_format
>
>currency_format for -321.255
>
>--> "-321,26" / "-321.26" (* depending on local currency format *)
Great! :-D But it still doesn't seem to make any difference on my G5 and
may even be slower on my older machine. Maybe it's a surfeit of its
rather than of tells. Mind you, the tells were only there in the first
place to accommodate the it * it multiplication. They're not necessary
otherwise:
on currency_format for v
(v div 1 as text) & (0.0 as text)'s character 2 & ((((v mod 1 as
text) * 100) ^ 2) ^ 0.5 + 0.5) div 1
end currency_format
currency_format for -321.255
:-)
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden