On Mon, 13 Feb 2006 22:24:45 +0100, "Janwillem Borleffs" <jw@jwscripts.com>
wrote:
Andy Hassall wrote: On 5.1.2 it does output 0.23.
Not on my WinXP installation, which produces 0.22
One of the related bug reports (http://bugs.php.net/bug.php?id=35986)
mentions that this isn't a bug, but due to the limited precision of floats.
Perhaps it's processor related...
Hum, 0.23 on Linux, 0.22 on Windows 2000. Both are Intel chips. Looks like
there's Windows-specific code in ext/standard/round.c :
#ifndef PHP_ROUND_FUZZ
# ifndef PHP_WIN32
# define PHP_ROUND_FUZZ 0.50000000001
# else
# define PHP_ROUND_FUZZ 0.5
# endif
#endif
#define PHP_ROUND_WITH_FUZZ(val, places) { \
double tmp_val=val, f = pow(10.0, (double) places); \
tmp_val *= f; \
if (tmp_val >= 0.0) { \
tmp_val = floor(tmp_val + PHP_ROUND_FUZZ); \
} else { \
tmp_val = ceil(tmp_val - PHP_ROUND_FUZZ); \
} \
tmp_val /= f; \
val = !zend_isnan(tmp_val) ? tmp_val : val; \
} \
Shame there's no comments explaining what this is there for.
--
Andy Hassall ::
an**@andyh.co.uk ::
http://www.andyh.co.uk http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool