>>you say
>>
>>?5-2^2
>>
>>different than
>>
>>?-2^2+5
>>
>>that can't acceptable...
>
>Hi Metin,
>
>Why so argumentative? IMHO this is a stupid discussion, we may jut as well discuss whether a cup is half full or half empty.
Hi Tore,
Because this is entertainment... Entertainment, because it's a so so basic problem and noone has an agreement about this...
>A vague or unclear task will always give room for interpretation, which this is all about. Plus it's a question of following defined standard. When I studied electronics 35 years ago, one of my subjects was advanced mathematics, and I mean really advanced mathemathics. We learned that the defined standard was that if a calculation started with a minus immediately followed by a number, it meant that the number had a negative value. If the minus was meant as an operator, the immediately following calculation should be inside a parenthesis. In your case this means:
>1. -2^2 == (-2)*(-2) = 4.
>2. -(2^2) == -(2*2) = -4
>3. 0-2^2 is 4 or -4 depending on which standard you follow. 5-2^2 will also give either 1 or 9 depending on which definition is followed.
>
>I really don't remember 100%, but I mean to recall that * and / had precedence over + and -. The reason why I don't remember was that we were told very clearly by our professor to play safe, and ALWAYS use parenthesises to avoid any confusion, misinterpretation and misunderstanding.
>
>Not all programs follows the same standards, which makes it necessary to EITHER use parenthesises OR check the documentation for the program in question. There is no "correct" or "wrong" answer here.
If we accept like you, there would be two standarts;
?5-2^2
?-2^2+5
Which standart VFP choosed according to these samples?
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement