Re: Exponential notation [was: Re: How to calculate/process thi
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.