• 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: About integers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: About integers


  • Subject: Re: About integers
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 1 Mar 2005 11:42:34 -0800

On Mar 1, 2005, at 11:19 AM, Doug McNutt wrote:

At 11:10 -0500 3/1/05, francois.houle wrote:

I was told that it should be possible to use applescript to add 32 bit
unsigned integers to a text file

From the AppleScript Language Guide:

The largest value that can be expressed as an integer in AppleScript is
±536870909, which is equal to ±(2^29- 3). Larger integers (positive or negative)
are converted to real numbers (expressed in exponential notation) when scripts
are compiled.

What the extra three bits are used for remains a mystery but adding (in the arithmetic sense) 32 bit integers is likely to result in an unexpected 64 bit floating point result.

Regardless, it should work with "write ... as [unsigned] integer", assuming the number is in the appropriate range for the type. You're relying on Apple Event Manager coercions at that point.


Two asides:

1. The ASLG is slightly wrong; the precise range is +2^29-1 ... -2^29. In other words, a 30-bit twos-complement signed integer.

2. The "missing" bits are used for a typed-pointer scheme in the implementation. It's a common trick in LISP implementations and other allocation-heavy environments.


--Chris Nebel AppleScript Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >About integers (From: "francois.houle" <email@hidden>)
 >Re: About integers (From: Doug McNutt <email@hidden>)

  • Prev by Date: Re: going from eudora to Mail
  • Next by Date: Re: Pseudo-regexp
  • Previous by thread: Re: About integers
  • Next by thread: RE: About integers
  • Index(es):
    • Date
    • Thread