• 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: How do I get the decimals?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I get the decimals?


  • Subject: Re: How do I get the decimals?
  • From: Graff <email@hidden>
  • Date: Thu, 29 Jul 2004 23:02:53 -0400

On Jul 29, 2004, at 9:57 PM, John W. Baxter wrote:

On 7/29/2004 18:36, "LuKreme" <email@hidden> wrote:

On 29 Jul 2004, at 16:35, Adam K. Wuellner wrote:
On Jul 29, 2004, at 4:55 PM, Michelle Steiner wrote:
If you want just the fraction,

266 / 11 - 266 div 11

--> 0.181818181818


or a two-operation version:

266 mod 11 / 11


Probably equal precedence with left-to-right within the precedence group.
That seems to be how it acts, anyhow...

10 mod 2 * 3 --> 0
10 mod (2 * 3) --> 4
10 * (2 mod 3) --> 20
10 * 2 mod 3 --> 2

Manual not at hand.

Here's the section from the manual. I formatted it for plain text. Some of the operators won't appear as the proper character on this list so I modified them a bit. They are:

less than or equal:
<=

greater than or equal:
>=

not equal:
!=

If you look at order number 4 you will see that div and mod are on equal precedence with * and / so they will indeed resolve left to right if they are used at the same level of an equation.

From page 372 of "AppleScript Language Guide" found at:
<http://developer.apple.com/documentation/AppleScript/Conceptual/ AppleScriptLangGuide/AppleScriptLanguageGuide.pdf>

Online version at:
<http://developer.apple.com/documentation/AppleScript/Conceptual/ AppleScriptLangGuide/AppleScript.103.html>

Table A-8 Operator precedence

Order
Operators
Associativity
Type of operator

1
( )
Innermost to outermost
Grouping

2
+ -
Unary
Plus or minus sign for numbers

3
^
Right to left
Exponentiation

4
* / w div mod
Left to right
Multiplication and division

5
+ -
Left to right
Addition and subtraction

6 &
Left to right
Concatenation

7
as
Left to right
Coercion

8
< <= > >=
None
Comparison

9
=
!=
None
Equality and inequality

10
not
Unary
Logical negation

11
and
Left to right
Logical for Boolean values

12
or
Left to right
Logical for Boolean values

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


References: 
 >Re: How do I get the decimals? (From: "John W. Baxter" <email@hidden>)

  • Prev by Date: Re: Strange path
  • Next by Date: Re: Saving/Reading RTFD Straight From AS with embedded
  • Previous by thread: Re: How do I get the decimals?
  • Next by thread: Re: How do I get the decimals?
  • Index(es):
    • Date
    • Thread