• 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 this one?]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Exponential notation [was: Re: How to calculate/process this one?]


  • Subject: Re: Exponential notation [was: Re: How to calculate/process this one?]
  • From: Paul Berkowitz <email@hidden>
  • Date: Sat, 27 Apr 2002 08:15:07 -0700

On 4/27/02 6:53 AM, "Mr Tea" <email@hidden> wrote:

> So, my question is, at what point does AppleScript start using exponential
> notation to represent numbers? And is there a way to convert exponential
> notation into, er, regular notation? (Ok. That was 2 questions.)

For integers:

536870911
+ 1
= 5.36870912E+8
= 2^29

For reals:

9999.9
+ .1
= 1.0E+4
= 10^4


to Stringify(x)
set x to x as string
set AppleScript's text item delimiters to {"E+"}
set {n, z} to {text item 1 of x, (text item 2 of x) as integer}
set i to character 1 of n
set d to text 3 thru -1 of n
set l to count d
repeat (z - l) times
set d to d & "0"
end repeat
return (i & d)
end Stringify

set x to 5.36870912E+8
set n to Stringify(x)
--> "536870912"

set x to 1.0E+4
set n to Stringify(x)
--> "10000"
--
Paul Berkowitz
_______________________________________________
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.

  • Follow-Ups:
    • Re: Exponential notation [was: Re: How to calculate/process this one?]
      • From: Paul Berkowitz <email@hidden>
References: 
 >Exponential notation [was: Re: How to calculate/process this one?] (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: How to calculate/process this one?
  • Next by Date: Re: Exponential notation [was: Re: How to calculate/process this one?]
  • Previous by thread: Exponential notation [was: Re: How to calculate/process this one?]
  • Next by thread: Re: Exponential notation [was: Re: How to calculate/process this one?]
  • Index(es):
    • Date
    • Thread