MACSCRPT Archives

May 2003

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Paul Berkowitz <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 14 May 2003 14:40:28 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (68 lines)
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

ATOM RSS1 RSS2