Difference between revisions of "Operator Reference"

6 bytes removed ,  16:31, 24 June 2018
m
→‎Note: Ceased referring to 0x80000001 as a "large negative integer", because it is, in fact, almost the smallest negative value that can be stored in a 32-bit two's-complement integer.
imported>Homecom
(→‎Math Operators: Corrected the mistaken claim that the modulo (%) operator does not work correctly for integers >= 0x80000001 (unsigned).)
imported>Homecom
m (→‎Note: Ceased referring to 0x80000001 as a "large negative integer", because it is, in fact, almost the smallest negative value that can be stored in a 32-bit two's-complement integer.)
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 0x80000001 (-2,147,483,647). 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