• 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: Applescript oddity under 10.4.11
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Applescript oddity under 10.4.11


  • Subject: Re: Applescript oddity under 10.4.11
  • From: Doug McNutt <email@hidden>
  • Date: Tue, 20 Apr 2010 14:33:27 -0600

At 12:06 -0500 4/20/10, Stockly, Ed wrote:
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_C7F32D159483edstocklylatimescom_"

In 10.4.11, when I try to compile this:

set valeur to valeur * 0.423333320617684
SNIP by DPM

There is a fundamental limit to the precision of floats and doubles. For a double, which AppleScript surely uses fails after 52 bits.  A fraction like 0.1000 (10) is not exactly representable being a repeating sequence that looks like:

0.000110011001100110011... (2) forever.   Think 1/16 + 1/32 + 1/256 + 1/512 . . . on a US ruler calibrated in fractions of an inch.

In the same way 1/3 in decimal is 0.3333333...(10) forever.

52 bits is about the same as 15 decimal digits but the exact value depends on the number.

I would bet that AppleScript is getting confused. There is also something about Applescript that refuses to use all 32 bits of a long integer. Some high order bit is likely being set to indicate that the value is actually a floating double. It's also possible that some bit in a double is doing something similar. If so the limit might be less than 52 bits. Its also possible that differences would show up in 64 vs 32 bit hardware.
--

Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.
 _______________________________________________
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

References: 
 >Re: Applescript oddity under 10.4.11 (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Applescript oddity under 10.4.11
  • Next by Date: Re: Timing a Long Event
  • Previous by thread: Re: Applescript oddity under 10.4.11
  • Next by thread: Waiting for a web page to be fully loaded
  • Index(es):
    • Date
    • Thread