Bug #14966: round() function doesn't always work

From: Date: Thu, 10 Jan 2002 14:53:28 +0000
Subject: Bug #14966: round() function doesn't always work
Groups: php.dev 
Request: Send a blank email to php-dev+get-76489@lists.php.net to get a copy of this message
From: rpb@community.net.uk Operating system: Compaq Tru64 v4.0E PHP version: 4.0.6 PHP Bug Type: *Math Functions Bug description: round() function doesn't always work If PHP is built without complete ANSI C prototypes in scope the 'round' function can fail. This is because the second argument to 'pow' in ext/standard/math.c:143 is an integer, and without prototypes it doesn't receive its implicit cast to a double, causing the 'pow' function to receive an undefined value on the stack. The simple fix is to put an explicit (double) cast in: f = pow(10.0, (double)places); A better fix might be to ensure that the ANSI version of the prototypes from <math.h> are always in scope, but that may be difficult to achieve across a wide variety of systems. -- Edit bug report at: http://bugs.php.net/?id=14966&edit=1

« previous php.dev (#76489) next »