Difference between revisions of "Operator Reference"

6 bytes removed ,  16:37, 24 June 2018
m
→‎Note: Made the first sentence easier to read by swapping the order of the hexadecimal and decimal example values.
imported>Homecom
(→‎Math Operators: Corrected the mistaken claim that the modulo (%) operator does not work correctly for integers >= 0x80000001 (unsigned).)
imported>Homecom
m (→‎Note: Made the first sentence easier to read by swapping the order of the hexadecimal and decimal example values.)
 
(One intermediate revision by the same user not shown)
Line 69: Line 69:
=== Note ===
=== Note ===


In the past, there was concern about the correctness of the [https://en.wikipedia.org/wiki/Modulo_operation modulo] (<code>%</code>) operator when applied to large negative integers (>= 0x80000001, AKA -2,147,483,647). Those concerns were unfounded.  
In the past, there was concern about the correctness of the [https://en.wikipedia.org/wiki/Modulo_operation modulo] (<code>%</code>) operator when applied to negative integers such as -2,147,483,647 (0x80000001). Those concerns were unfounded.  


''The modulo operator produces correct results in all cases'', but it must be understood that the result will have the sign of the dividend in Papyrus (as in Java and many other languages), therefore <code>3 % 2 == 1</code> and <code>-3 % 2 == -1</code>.
''The modulo operator produces correct results in all cases'', but it must be understood that the result will have the sign of the dividend in Papyrus (as in Java and many other languages), therefore <code>3 % 2 == 1</code> and <code>-3 % 2 == -1</code>.
Anonymous user