ParserFunctions/MOD10000

From Meta, a Wikimedia project coordination wiki

Jump to: navigation, search

32 20060618093259 3259 3229 3200

"{{#expr: 20060618093259 mod 10000}}" gives "3259" [1] sometimes gives -6357, try about twenty rapid purge to see 6356. Update, no such problem for smaller numbers:

"{{#expr: 20091117075003 mod 10000}}" gives "5003" [2],
"{{#expr: (20091117075003 - 10000000000*2009) mod 10000}}" gives "5003" [3].

Second update, the PHP issue with mod is ancient history, it works for integers but not float. Some Wikimedia servers run with 32 bits processors, other with 64 bits. With load balancing users might get 32 or 64 bits, and if they get 32 bits mod won't work as expected for larger integers. Testing that theory:

"{{#expr: 2147483647 mod 5|=}}" gives "2" [4], "{{#expr: 2147483648 mod 5|=}}" gives "3" [5],
"{{#expr: 4294967295 mod 5|=}}" gives "0" [6], "{{#expr: 4294967296 mod 5|=}}" gives "1" [7].