Re: Exponential notation [was: Re: How to calculate/process this one?]
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 10:48:03 -0700
On 4/27/02 8:15 AM, "Paul Berkowitz" <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
Since this is true also of negative integers, and of 0, it means that
AppleScript can handle up to 2^30 integers. I think these are also known as
"longs". After that it has to coerce integers to reals, which i think are
called "floating point" calculations. I'm not sure how many of those there
are, or if there is any limit. There is also something called "small
integer" in AppleScript, which are also known as "shorts". The limits for
those are -32768 and 32767, so there are 2^16 of those. I think that other
programs make more of a distinction between shorts and longs than
AppleScript does.
>
>
For reals:
>
>
9999.9
>
+ .1
>
= 1.0E+4
>
= 10^4
This appears to be just a matter of notation, rather than any sort of "real"
limit (pardon the pun). I'm not sure if there's a limit to the number of E+
places, but I guess there must be. Let's try.
OK. Somewhere between 1.797693134862E+308 and 1.797693134863E+308, the
"result of a numeric calculation was too large". (The first of those numbers
works, the second doesn't, with that error.) The limit for reals is
somewhere in there. Adding any more decimal places after the final '2'
creates a syntax error, so I have to stop here, long before the 307th
decimal place. I have no idea how many zillion this represents, nor what
power of 2 (or even if it could be represented as a power of 2 without using
E notation for the exponent itself!). Does anyone know the significance of
this amazing number? Multiply by 2, because it works for negatives too.
--
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.