Last modified: 2008-08-11 20:20:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11156 - Formatnum and expr gives erroneous calculation
Formatnum and expr gives erroneous calculation
Status: RESOLVED WORKSFORME
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-02 16:57 UTC by Joanjoc
Modified: 2008-08-11 20:20 UTC (History)
1 user (show)

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


Attachments

Description Joanjoc 2007-09-02 16:57:10 UTC
This error ocurrs in wikipedias using comma as a decimal separator according to the wiki's default locale, like in catalan wikipedia. 

Tthe formatnum magicword almost follows the wiki locale, but the parser function #expr: use the dot as a decimal separator. This differences results in erroneous calculus in some templates. There's a set of examples at; 

http://ca.wikipedia.org/wiki/Usuari:Joanjoc/formatnum
Comment 1 Jelte (WebBoy) 2008-08-11 20:20:21 UTC
You should use only English numbers without thousand separator (like 1000000.45) in #expr and formatnum without R.

To transform numbers from a local number ( like 1.000.000,45 ) to an English number without thousand separator, use {{formatnum: number |R}} (note the R):

{{formatnum: 1.000.000,45 |R}} => 1000000.45

Therefore, to multiply a local number with 10, and output a local number, you should use:

{{formatnum: {{#expr: {{formatnum: 5.199,75 | R }} * 10 }} }}

Output: 51.997,5

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


Navigation
Links