Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Math Formula
Message
De
15/12/2008 06:23:06
 
 
Information générale
Forum:
Politics
Catégorie:
Autre
Titre:
Divers
Thread ID:
01366554
Message ID:
01367358
Vues:
10
>>
>>-24/4(-2)
>>
>>Is it:
>>
>>-6(-2) = 12
>>
>>Or is it:
>>
>>-24/-8 = 3
>>
>
>From the help file:
>
>
>Numeric operators function with all numeric values. The following table lists the numeric operators in order of precedence.
>
>Numeric Operators
>Operator  Action  Code  
>( )
> Group subexpressions
> (4-3) * (12/nVar2)
> 
>**, ^
> Exponentiation
> ? 3 ** 2
>
>? 3 ^ 2
> 
>*, /
> Multiplication and division
> ? 2 * 7
>
>? 14 / 7
> 
>%
> Modulus (remainder)
> ? 15 % 4
> 
>+, -
> Addition and subtraction
> ? 4 + 15
> 
>
Mike,

The help file does not talk about associativity

Associativity tells you in what order you evaluate operators with equal precedence

Most of them are Left associative, ie
-24 / 4 * (-2)
(-24 / 4) * (-2)

-24 * 2 / 3
(-24 * 2 ) / 3
In fortran the exponent operator is right associative
2 ^ 3 ^ 2 = 2 ^ (3^2) = 2 ^ 9
In C#, assignment operators, unary operators and the conditional operator are Right associative
(I have posted this before http://msdn.microsoft.com/en-us/library/aa691323(VS.71).aspx )
int x = 0;
int y = -~x ;// 1
int z = ~-x; // -1
Update: about exponents http://mathforum.org/library/drmath/view/53887.html
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform