Re: Weird results with floor compiling with -march=pentium4 -mcpu=pentium4

From: Date: Wed, 09 May 2007 02:19:01 +0000
Subject: Re: Weird results with floor compiling with -march=pentium4 -mcpu=pentium4
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-254623@lists.php.net to get a copy of this message
Rodolfo Gonzalez Gonzalez wrote:
Hi, Just for the record. I compiled PHP 5.2.2 with CFLAGS="-O2 -march=pentium4 -mcpu=pentium4", as usual (I've done so with all the 5.x.x series, and the proc is a Pentium 4, of course) and a customer complained about weird results in one of his scripts. I isolated the problem to be related to the floor function. The problem was that it returned weird results. Sample script: <?php $nt = 100; $promrow2['uni_gifts'] = 1; $promrow2['unidades'] = 10; $calc_cnt=floor(($nt*$promrow2['uni_gifts'])/$promrow2['unidades']); print $calc_cnt; ?> printed :.0000000001 Casting to integer the value returned by floor solved the problem. I recompiled with CFLAGS="-O2 -march=i686 -mcpu=i686" and the problem was solved too. I've compiled 5.2.2 with nocona optimizations without problems in other machines, so I don't consider this a normal behavior. But report submited. Has anyone faced the same problem?.
Best to ask the -internals list, they will be able to help a lot better than we can. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#254623) next »