• 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: Fwd: Int Function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Int Function


  • Subject: Re: Fwd: Int Function
  • From: Doug McNutt <email@hidden>
  • Date: Sun, 18 Aug 2002 19:26:25 -0600

>On Sunday, August 18, 2002, at 05:24 PM, Chuck Ross wrote:
>>Can anyone give me an easy way to get the Int of a number, converting, for instance, 6.1 into 6?

set x to 3.45
set y to round (x)
set classofY to class of y
display dialog classofY

The dialog returns "long" but the EventLog is silent.
Somehow I suspect that long is different from integer as generally known by AppleScript. Is it one of those finder classes that doesn't show up in the dictionary? We were surprised that the visible property didn't a few days ago.

set x to 2 ^ 29
set y to round (x)
set classofY to class of y
display dialog classofY

Returns "doub"
That isn't even defined in ASLG. Is it the same as IEEE double?

2^28 returns "long" which also isn't in the ASLG. Presumably it's an AppleScript integer.

set x to 2 ^ 24 + 0.5
set y to (round (x) as integer)
set classofY to class of y
display dialog classofY

generates error "cant make 1.6777. . .E7 into integer."

long is a 32 bit signed integer in most of the Apple APIs.

An integer in AppleScript is limited to 29 bits.

I would appreciate a learned discussion of the differences and just how they affect AppleScripters. Those classes "long" and "doub" are curious. 1.6777. . .E7 is clearly less than 2^29 and ought to be coerceable to integer.

--
--> As a citizen of the USA if you see a federal outlay expressed in $billion then multiply it by 4 to get your share in dollars. <--
_______________________________________________
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.

  • Follow-Ups:
    • Re: Int Function
      • From: Christopher Nebel <email@hidden>
References: 
 >Fwd: Int Function (From: Michelle Steiner <email@hidden>)

  • Prev by Date: Re: getting a file list in sorted order
  • Next by Date: Re: getting a file list in sorted order
  • Previous by thread: Fwd: Int Function
  • Next by thread: Re: Int Function
  • Index(es):
    • Date
    • Thread