• 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: magic integer converter number 62?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: magic integer converter number 62?


  • Subject: Re: magic integer converter number 62?
  • From: "Arthur J Knapp" <email@hidden>
  • Date: Wed, 21 Feb 2001 12:13:49 -0500

> Date: Mon, 19 Feb 2001 18:23:39 -0800
> From: John W Baxter <email@hidden>
> Subject: Re: magic integer converter number 62?

>>Can anybody figure out why this works:
>>set x to 62
>>set b to ((x + (2.6 - (2.6 mod 1))) - x) as integer

> My problem is that I can't immediately figure out why the first form
> "works" (produces 2 rather than an error about not being able to make
> [approximately] 2.0 into an integer).
>
> Let's look at this smaller part of the puzzle:
>
> set c to 2.6 - (2.6 mod 1)
> c - 2
>
> The result is not 0, it is the small non-zero number
> 5.77315972805081E-15

???

2.6 mod 1

means divide 2.6 by 1, then return the remainder, 0.6

2.6 - (2.6 mod 1) --> 2.6 - 0.6 --> 2.0

c - 2 --> 0.0

--
{
Arthur J Knapp, of STELLARViSIONs ;

http://www.STELLARViSIONs.com ;

mailto:email@hidden ;

http://developer.apple.com/techpubs/
macos8/InterproCom/AppleScriptScripters/
AppleScriptLangGuide/
}


  • Prev by Date: Has the 5th business day of the month passed???
  • Next by Date: Re: Scriptable Text Editor
  • Previous by thread: Re: magic integer converter number 62?
  • Next by thread: Re: magic integer converter number 62?
  • Index(es):
    • Date
    • Thread