• 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: "Francois Houle" <email@hidden>
  • Date: Wed, 2 Mar 2005 10:54:49 -0500
  • Thread-topic: About integers

Basically what I want ot do is this:

set Dialog_1 to display dialog "The application requires your administrative password to run: " default answer ""
set admin_user to the text returned of the result

Now what I would like to do is to have admin_user become a 32 bit unsigned integer that then gets writen properly to a basic text file.

-----Original Message-----
From: applescript-users-bounces+francois.houle=email@hidden [mailto:applescript-users-bounces+francois.houle=email@hidden] On Behalf Of Christopher Nebel
Sent: Tuesday, March 01, 2005 2:43 PM
To: AppleScript Users
Subject: Re: About integers

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
 _______________________________________________
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

  • Follow-Ups:
    • Re: About integers
      • From: "John C. Welch" <email@hidden>
    • Re: About integers
      • From: Christopher Nebel <email@hidden>
    • RE: About integers
      • From: Emmanuel <email@hidden>
  • Prev by Date: Re: Auto Mount Server with Apple Script (Beginner Here)
  • Next by Date: Re: Beginner's scripting Terminal questions
  • Previous by thread: Re: About integers
  • Next by thread: RE: About integers
  • Index(es):
    • Date
    • Thread