Sender: |
|
Mime-version: |
1.0 |
Date: |
Wed, 14 May 2003 14:40:28 -0700 |
Reply-To: |
|
Content-type: |
text/plain; charset="US-ASCII" |
Subject: |
|
From: |
|
In-Reply-To: |
|
Content-transfer-encoding: |
7bit |
Parts/Attachments: |
|
|
On 5/14/03 2:10 PM, "Franz Walter Klein" <[log in to unmask]> wrote:
> By now we know that:
>
> - There are three integer types in AS,
> - plain (default) integer is longer than 16 bit
> - plain (default) integer may be shorter than 29 bit
>
> Is there any source at Apple to get a clear answer on the question: "Which
> file length can be addressed by the integer position parameter in read?"
Just a few days ago, on May 2 in the thread "Strange numbers to AS", Chris
Nebel of Apple said:
"Integers in AppleScript only go up to 2^29 (about 500 million).
There's a check that tries to promote too-large numbers into reals, but
you've found a case that slips through the overflow detection and
produces a nonsensical result. Write a bug."
So there's an authoritative confirmation for your 2^29 supposition.
(Evidently (2^29) -1). Since 'read' uses 'double integer' type for its
'from', 'to' and 'for' parameters, you ought to be able to go higher.
2 ^ 29 as double integer
--> 5.36870912E+8 -- no error
2 ^ 62 as double integer
--> 4.61168601842739E+18
(2 ^ 62) as real
--> 4.61168601842739E+18
(So 'real' is same as 'double integer'.)
2 ^ 63 as double integer
--> -9.22337203685478E+18
(It's now going backwards. There is no 'unsigned double integer').
(2 ^ 63) - 1 as double integer
--> -9.22337203685478E+18
2 ^ 64 as double integer
--> -1.0
(and all higher numbers)
I don't think the negative numbers are going to help much.
2 ^ 62 + ((2 ^ 62) - 1)
--> 9.22337203685478E+18
seems to be the positive limit for double integers.
So if 'read' fails earlier than that, I think there must be a bug, or at
least an incomplete description of the limit ("double integer") in Standard
Additions dictionary.
--
Paul Berkowitz
|
|
|