• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Currency Numbers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Currency Numbers
      • From: kai <email@hidden>
  • Prev by Date: Re: Down grading from 10.3.9 to 10.2.8
  • Next by Date: Re: Currency Numbers
  • Previous by thread: Re: Currency Numbers
  • Next by thread: Re: Currency Numbers
  • Index(es):
    • Date
    • Thread