On 2/1/09 3:13 AM, Robert Rohde wrote:
> Noticing errors isn't the hard part, but the common user will have a
> hard time figuring out how to avoid them.
>
> For example:
>
> {{#expr:floor(0.00007*100000)}} = 6
> {{#expr:0.07*100 = 7}} is False
> {{#expr:5/6 = (1/6)*5}} is False
> {{#expr:(10^16 + 1) % 10}} = 0
>
> All of these are examples of floating point quirks, but at the same
> time none of them is so complicated that analogous expressions
> wouldn't come up in practical situations. From the point of view of a
> non-programmer Mediawiki user, this behavior is both unexpected and
> cryptic.
>
> The first three are fixable, provided one applies some reasonable
> tolerance for when two numbers are the same. The fourth would require
> big math, or failing that should probably generate an error.
Added a bug entry for supporting bcmath, which has a handy extension in
PHP, if anybody's interested. As Tim notes this would probably not be
terribly difficult nor a perf problem though you'll still have precision
cutoffs... but they'll be more predictable and comprehensible to humans
used to working in decimal. :)
https://bugzilla.wikimedia.org/show_bug.cgi?id=17468
-- brion
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l