Page MenuHomePhabricator

round return non-integer results on small integers
Closed, ResolvedPublic

Description

Evaluating {{#expr: 1 round 11}} on Wikimedia wikis gives "1.00000002048" (error: ~2e-8) instead of "1". I noticed a similar problem for other integers or floating-points numbers < 1000, for precision 11, 12 and 13. I tested this on fr.wikipedia.org, en.wikipedia.org and test.wikimedia.org.

On a local installation of MediaWiki after syncing MediaWiki and the ParserFunction extension at git head (configuration: 32-bit, Ubuntu, PHP 5.5.9), I cannot reproduce this issue (I get "1" as expected).

(this bug has been reported on https://fr.wikipedia.org/wiki/Wikip%C3%A9dia:Le_Bistro/3_d%C3%A9cembre_2014#round)

Event Timeline

Orlodrim raised the priority of this task from to Needs Triage.
Orlodrim updated the task description. (Show Details)
Orlodrim added a project: ParserFunctions.
Orlodrim changed Security from none to None.
Orlodrim added a subscriber: Orlodrim.
Jackmcbarn added a subscriber: Jackmcbarn.

I have a suspicion that this is HHVM-related. Every HHVM server I've tried it on has had the bug, and every Zend server has worked correctly.

Seems like it's just round 11, 12 or 13 (some basic tests)

Mainframe98 added a subscriber: Mainframe98.

https://www.mediawiki.org/wiki/User:Fbstj/T76641 does no longer show this issue, nor do my tests today: https://test.wikipedia.org/wiki/User:Mainframe98/Sandbox. (Using HHVM - PHP7 beta feature temporarily disabled)