(02-14-2023, 07:21 PM)Kernelpanic Wrote: As already mentioned, the order in which the individual operators are considered is important.
Different operators at the same level are so executed: the leftmost operation first, the rightmost operation last.
If one want to be absolutely sure that a calculation is carried out in a certain order, then one just put brackets.
(a = 4.000 - a2 = 0.063 - a3 = 2.500)
Code: (Select All)'Rangfolge von Operatoren - 14. Feb. 2023
'QuickBasic Befehlsverzeichnis 3.2
$Console:Only
Option _Explicit
Dim As Double a, a2, a3
a = 100 Mod 17 / 3
Print Using "###.###"; a
'There is one exception to the normal ranking:
'If an expression has adjacent exponentiation and negation operators,
'then the negation is performed first.
a2 = 4 ^ -2
Print Using "###.###"; a2
'The leftmost operation first, the rightmost operation last.
'According to their order of operations (Rangfolge)
a3 = 3 + 6 / 12 * 3 - 2
Print Using "###.###"; a3
End
The whole point of my OP was to indicate that the documentation does not match the behaviour.
All of the clarifications of behaviour in this thread are nice, but not of much use if the documentation isn't updated accordingly.
Who, learning QB64pe, is going to read about Order of Operations via a search of the forums versus reading the documentation in the wiki? (Or maybe documentation is out of fashion and I need to get with the times.)
Meh. I bow out of this discussion and leave it to the rest of the community to figure it out.