Date: Wed, 12 Apr 2006 12:09:17 +0200 From: Krzysztof Nakielski <nakiel@nakiel.net> To: freebsd-questions@freebsd.org Subject: round() problem Message-ID: <20060412100917.GA1406@nakiel.dyndns.org>
next in thread | raw e-mail | index | archive | help
Hi, I am having problem with round() function in php, python, mysql. I am not sure if thats FreeBSD issue. I receive the same results on 4.11, 5.4 and 6.0. php (4.4.1, 5.1.2): %php -r 'print round(8.075, 2) ."\n";' 8.07 %php -r 'print round(8.085, 2) ."\n";' 8.09 %php -r 'print round(0.075, 2) ."\n";' 0.08 Python (2.4.2): >>> print "%.2f" % round(8.075, 2) 8.07 >>> print "%.2f" % round(8.085, 2) 8.09 >>> print "%.2f" % round(1.075, 2) 1.08 mysql (4.1.18): +-----------------+ | round(8.075, 2) | +-----------------+ | 8.07 | +-----------------+ +-----------------+ | round(8.085, 2) | +-----------------+ | 8.09 | +-----------------+ +-----------------+ | round(6.075, 2) | +-----------------+ | 6.08 | +-----------------+ In PostgreSQL everything seems to be ok. Is this function wrong implemented in php, python, mysql? Thanks, -- * Krzysztof Nakielski * * System Administrator *
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060412100917.GA1406>