Re: iPhoto returns a real number as a photo id
Re: iPhoto returns a real number as a photo id
- Subject: Re: iPhoto returns a real number as a photo id
- From: "Mark J. Reed" <email@hidden>
- Date: Wed, 16 Jun 2010 06:43:04 -0400
On Wednesday, June 16, 2010, Shane Stanley <email@hidden> wrote:
> On 16/6/10 4:24 PM, "has" <email@hidden> wrote:
>
>> It also defines a conventional class, BigInt, which can represent integers of
>> unlimited size, and switches between the two more or less transparently.
>
> I thought you were hinting that such a beast exists in AS.
That would be nice, but no. Though I suppose one could use the GNU
arbitrary-precision arithmetic library to write an OSAX that provided
some such functionality, it wouldn't be as nicely integrated as it is
in Ruby. At least there's always 'do shell script "bc"'.
>> with the eventual loss of precision that entails
>
> In what circumstances?
As soon as the value grows beyond the size of the mantissa, you lose
the low bits. A 64-bit IEEE floating-point value has an effective
53-bit mantissa, so 2^53 is indistinguishable from 2^53+1, 2^54+3
rounds to 2^54+4, etc. Floating-point arithmetic breaks algebraic
assumptions:
set x to 2^55
x + 6 - x
--> 8.0
Which means if iPhoto is really handing back 64-bit integers that are
getting coerced to floating point, then you could potentially have
id's that are distinct within iPhoto show up as the same value in AS.
If it's just reusing internal pointers for the purpose, however, this
is unlikely, since objects will necessarily be separated in memory by
the size of their representation.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden