The big warning box on the float type page (http://php.net/float) suggest bc (http://www.php.net/manual/en/ref.bc.php)
--- Simon Welsh Sent from my iPad On 7/09/2010, at 17:12, Michael Adams <[email protected]> wrote: > > In Javascript i solved this issue (after two years) by using: > > **** > function round(number) { > return parseFloat(number.toPrecision(12)); > } > **** > > The "toPrecision(12)" rounds to 12 significant digits which is well within > acceptable tolerances for my practical application: > http://www.quickconvert.net/index.html > http://www.quickconvert.net/javascript/calculate.js > > It does however leave trailing zeros below the decimal point. I > found "parseFloat()" stripped those nicely. > > Is there a PHP equivalent way to tidy double float math? I intend to offer a > real form alternative to those not using Javascript on this site. > > -- > NZ PHP Users Group: http://groups.google.com/group/nzphpug > To post, send email to [email protected] > To unsubscribe, send email to > [email protected] -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected]
