Re: cvs: php4(PHP_4_2_0) /ext/standard math.c

From: Date: Sat, 06 Apr 2002 10:19:06 +0000
Subject: Re: cvs: php4(PHP_4_2_0) /ext/standard math.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-10921@lists.php.net to get a copy of this message
On Sat, 6 Apr 2002, Andi Gutmans wrote: > Isn't it always in math.h? It should be, but it cased problems on Tru64 Unix, and it doesn't do any harm anyways. From the bugreport: " 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. " regards, Derick > At 09:21 01/04/2002 +0000, Derick Rethans wrote: > >derick Mon Apr 1 04:21:29 2002 EDT > > > > Modified files: (Branch: PHP_4_2_0) > > /php4/ext/standard math.c > > Log: > > - MFH for fix for bug #14966 > > > > > >Index: php4/ext/standard/math.c > >diff -u php4/ext/standard/math.c:1.80 php4/ext/standard/math.c:1.80.2.1 > >--- php4/ext/standard/math.c:1.80 Sat Mar 2 12:08:09 2002 > >+++ php4/ext/standard/math.c Mon Apr 1 04:21:29 2002 > >@@ -19,7 +19,7 @@ > > +----------------------------------------------------------------------+ > > */ > > > >-/* $Id: math.c,v 1.80 2002/03/02 17:08:09 hholzgra Exp $ */ > >+/* $Id: math.c,v 1.80.2.1 2002/04/01 09:21:29 derick Exp $ */ > > > > #include "php.h" > > #include "php_math.h" > >@@ -138,7 +138,7 @@ > > return_val = (Z_TYPE_PP(value) == IS_LONG) ? > > > >(double)Z_LVAL_PP(value) : Z_DVAL_PP(value); > > > >- f = pow(10.0, places); > >+ f = pow(10.0, (double) places); > > > > return_val *= f; > > if (return_val >= 0.0) > > > > > > > >-- > >PHP CVS Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ----------------------------------------------------------------------- Did I help you? Consider a gift: http://www.amazon.co.uk/exec/obidos/registry/SLCB276UZU8B ----------------------------------------------------------------------- PHP: Scripting the Web - derick@php.net All your branches are belong to me! SRM: Script Running Machine - www.vl-srm.net -----------------------------------------------------------------------

« previous php.cvs (#10921) next »