• 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: Exponential notation [was: Re: How to calculate/process thi
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exponential notation [was: Re: How to calculate/process thi


  • Subject: Re: Exponential notation [was: Re: How to calculate/process thi
  • From: Nigel Garvey <email@hidden>
  • Date: Sun, 28 Apr 2002 11:30:15 +0100

has wrote on Sat, 27 Apr 2002 23:03:27 +0100:

>Arthur J Knapp wrote:
>
>> I would strongly recomend that you steal, oh, er, I mean *borrow* the
>>very robust numToStr() handler from ScriptBuilders:
>
>
>"Robust"? Bah...
>
>set AppleScript's text item delimiters to "foo"
>numToStr(1)
>--> "1foofoo"
>
>:p
>
>Might warm the pot, but does he remember to put the tea in after? (Nigel,
>I'm most ashamed of you!:)

Don't worry. There's no connection with me that need make *you* feel
ashamed. :-)

Thank you for pointing out that my handler will produce an incorrect
result if the TID's have been deliberately set to (or stupidly left in)
an incorrect state beforehand. This doesn't happen with the update I'm
currently considering, so I'll get it out as soon as possible. (Does
anyone know of a test to see if the computer's actually switched on?)

>on realToString(theReal)
> try
> tell theReal as real as string
> if it does not contain "E" then
> if it mod 1 is 0 then return it as integer as string
> return it as string
> end if

set aardvark to (1234.56 + 7248.83)

realToString(aardvark)
--> "8483.389999999999"

The best fix for your version at the moment would seem to be:

on realToString(theReal)
set oldTIDs to applescript's text item delimiters
set applescript's text item delimiters to {""}
set str to numToStr(theReal)
set applescript's text item delimiters to oldTIDs
return str
end realToString

realToString(aardvark)
--> "8483.39"

NG
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Getting every link from a webpage in explorer
  • Next by Date: Finder's update
  • Previous by thread: Re: Set BOUNDS to FileMaker Pro
  • Next by thread: Re: Exponential notation [was: Re: How to calculate/process thi
  • Index(es):
    • Date
    • Thread