https://bugzilla.wikimedia.org/show_bug.cgi?id=6068
--- Comment #58 from Philippe Verdy <[email protected]> --- One example demontrates the difference: * {{#expr: 0.9900000001 -floor( 0.9900000001 / 0.03 ) * 0.03 }} :: :: This uses PHP's fmod() function but arguments are left as :: double, no rounding occurs and precision is kept :: Expected value: 1E-10 with 8 digits of precision :: The result is: 1.0000000827404E-10 :: (excellent order of magnitude and precision) * {{#expr: 0.9900000001 mod 0.03 }} :: :: This uses PHP's fmod() function but arguments are incorrectly :: downcasted to float, forcing rounding and loss of precision. :: Expected value: 1E-10 with 8 digits of precision :: The result is: 4.4408920985006E-16 :: (bad: 6 orders of magnitude lost, out of precision) * {{#expr: (2*PI) -floor( (2*PI) / (PI/6) ) * (PI/6) }} :: :: Expected value: 0 with an absolute error not exceeding PI/2*1E-14 :: Effective result: 0 :: (excellent, but could be by chance; for other divisors set to (PI/N), where N is an odd prime, the max error of PI/2/N*1E-14 is respected) * {{#expr: (2*PI) mod (PI/6) }} :: :: Expected value: 0 with an absolute error not exceeding PI/2*1E-14 :: Effective result: 1.0000003602961E-10 :: (very bad, the absolute error is too large by a factor of about 1E7) -- You are receiving this mail because: You are on the CC list for the bug. You are the assignee for the bug. You are watching all bug changes. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
