Output a big red error when giving numbers that will encounter a floating point error?
Perhaps also provide a # of use limited #expr equivalent that will use a bignum library rather than normal numbers which can be used in cases where that big red error shows up.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com] -Nadir-Point (http://nadir-point.com) -Wiki-Tools (http://wiki-tools.com) -MonkeyScript (http://monkeyscript.nadir-point.com) -Animepedia (http://anime.wikia.com) -Narutopedia (http://naruto.wikia.com) -Soul Eater Wiki (http://souleater.wikia.com)
Robert Rohde wrote:
On Sat, Jan 31, 2009 at 9:39 PM, Tim Starling tstarling@wikimedia.org wrote:
greg_l_at_wikipedia wrote:
As I understand it, there is rightfully little interest in the developer community to write a new parser function for every single template need to come along.
Therefore, when it comes to a template like {{val}}, which now generates rounding errors about 5–10% of the time because of the math- based parser functions it must use, it would be nice if the template- authoring community could have a character-counting parser function that is not only suitable for {{val}}, but which could be a general - purpose parser function that could be used for a great variety of purposes.
I would rather have an application-specific number formatting function, rather than a character-counting function. It could be similar to PHP's number_format(). Wikitext is a terrible programming language, slow to execute and hard to understand. It's much better to write in PHP.
We already have {{formatnum:}} with a very limited functionality that presumably could be extended.
Though I would like to re-emphasize that Greg's complaint principally arrises because of floating point round-off errors in #expr that are difficult for normal editors to predict or plan for, and that should be addressed irrespective of other work to improve number formatting.
-Robert Rohde