Last modified: 2014-11-15 12:01:16 UTC
{{#expr: 1000.33 - 1000}} sometimes evaluates to 0.33, other times to 0.33000000000004 (the second one happens far more often). I'm not sure which one is correct (it has the right magnitude for a floating point precision error, 0.00000000000004 being about the 10^17-th part of 1000, and 2^53 ~= 10^16 (a double uses 53 bits for the mantissa), though as far as my understanding of floating point arithmetic goes, that should be rounded off), but the nondeterministic behavior is definitely weird.
In a php shell (PHP 5.2.6, Win XP) floatval("1000.33") - floatval("1000") evaluates exactly to 0.33.
Maybe related to bug 6356?
(In reply to Tisza Gergő from comment #0) > {{#expr: 1000.33 - 1000}} sometimes evaluates to 0.33, other times to > 0.33000000000004 (the second one happens far more often). Does "sometimes" refer to the same wikipage / site? Or are results consistent on the same site? Can this still be seen? Also getting 0.33000000000004 on mediawiki.org.
(In reply to Andre Klapper from comment #3) > Does "sometimes" refer to the same wikipage / site? Or are results > consistent on the same site? Can this still be seen? According to the reporter, the same wikipage produced different results when reevaluated. I can't reproduce that now, though.