• 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: Simple multiplication going bizarre
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple multiplication going bizarre


  • Subject: Re: Simple multiplication going bizarre
  • From: Luther Fuller <email@hidden>
  • Date: Fri, 30 Apr 2010 14:40:45 -0500

Today, I had time to finish what I started yesterday.

on numericalTextNoExp(x)
set numText to (x as text)
set AppleScript's text item delimiters to {"E", "."}
if (count text items of numText) < 3 then return numText
set intText to (text item 1 of numText)
set fracText to (text item 2 of numText)
set expNr to (text item 3 of numText) as number
if expNr > 0 then -- move dp to right expNr places
repeat
if (length of fracText) > expNr then exit repeat
set fracText to (fracText & "0")
end repeat
intText & (text 1 thru expNr of fracText) & "." & (text (1 + expNr) thru -1 of fracText)
return the result
else if expNr < 0 then -- move dp to left expNr places
set expNr to -expNr
repeat
if (length of intText) > expNr then exit repeat
set intText to ("0" & intText)
end repeat
set n to ((length of intText) - expNr)
(text 1 thru n of intText) & "." & (text (1 + n) thru -1 of intText) & fracText
return the result
end if
error "The exponent equals 0." -- -2700
end numericalTextNoExp -----------------------

Hope this is useful.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Simple multiplication going bizarre (From: Richard Lake <email@hidden>)

  • Prev by Date: FileMaker Pro 10 Insert Picture-Not Links
  • Previous by thread: Re: Simple multiplication going bizarre
  • Next by thread: Rep: Simple multiplication going bizarre
  • Index(es):
    • Date
    • Thread