Mombu the Php Forum

Go Back   Mombu the Php Forum > Php > Weird results with floor compiling with -march=pentium4 -mcpu=pentium4
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 23rd September 05:21
rodolfo
External User
 
Posts: 1
Default Weird results with floor compiling with -march=pentium4 -mcpu=pentium4



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?.

Software:

PHP 5.2.2
GCC 3.2.2

Regards,
Rodolfo.
  Reply With Quote


 


2 23rd September 05:24
dmagick
External User
 
Posts: 1
Default Weird results with floor compiling with -march=pentium4-mcpu=pentium4



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/
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Php 5 forum, Apache forum, Iis forum, Functions forum, Classes forum, Librarys forum, Bugs forum, Postgres forum, Mysql forum, Paradox forum, Ms sql forum, Configurations forum, Php.ini forum, Problems forum, Scripting forum, Css forum, General forums, Off-topic talk, Links, Extra forums, Php


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666