https://bugzilla.wikimedia.org/show_bug.cgi?id=33571
--- Comment #6 from Platonides <[email protected]> 2012-01-07 14:22:56 UTC --- Created attachment 9821 --> https://bugzilla.wikimedia.org/attachment.cgi?id=9821 test of the C functions php -r 'printf("%.32f\n", log(pow(10,15)-1,10) );' 14.99999999999999822364316059974954 php -r 'printf("%.32f\n", log10(pow(10,15)) );' 15.00000000000000000000000000000000 php -r 'printf("%.32f\n", log(pow(10,15)-1,10) );' 14.99999999999999822364316059974954 It's more or less normal to have a few differences between machines in floating point behavior http://c-faq.com/fp/strangefp.html log(x), log10(x) and floor(x) are simple wrappers to the C functions. However, log(x,y) is log(x) / log(10), which is where I am getting the difference. I think we could instead of floor use round(x, 0, PHP_ROUND_HALF_DOWN); i.e. round(log(1000000000000000,10), 0, PHP_ROUND_HALF_DOWN) it has a number of checks to get the appropiate value. -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
