Last modified: 2014-11-15 12:01:16 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T20233, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 18233 - nondeterministic #expr rounding error
nondeterministic #expr rounding error
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Low minor with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://hu.wikipedia.org/w/index.php?t...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-03-28 19:46 UTC by Tisza Gergő
Modified: 2014-11-15 12:01 UTC (History)
0 users

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tisza Gergő 2009-03-28 19:46:01 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.
Comment 1 Tisza Gergő 2009-03-28 19:49:54 UTC
In a php shell (PHP 5.2.6, Win XP) floatval("1000.33") - floatval("1000") evaluates exactly to 0.33.
Comment 2 Tisza Gergő 2009-03-28 20:21:35 UTC
Maybe related to bug 6356?
Comment 3 Andre Klapper 2014-10-26 14:34:19 UTC
(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.
Comment 4 Tisza Gergő 2014-11-02 14:57:02 UTC
(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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links