ID:               33584
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ruslan_y at list dot ru
-Status:           Open
+Status:           Closed
 Bug Type:         Math related
 Operating System: Linux Fedore Core 4
 PHP Version:      4.3.11
 New Comment:

Compiler bugs are not PHP bugs.



Previous Comments:
------------------------------------------------------------------------

[2005-07-06 20:16:09] ruslan_y at list dot ru

I've made some research and got the solution...

If I'm using gcc4 the round() function is broken
---
#gcc -v 
...
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)
---

but after installing gcc2.96 and recompiling php (./configure; make)
---
#gcc -v 
...
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-126)
---
round() works just fine.

------------------------------------------------------------------------

[2005-07-06 13:45:47] ruslan_y at list dot ru

It's all right with php5-latest (php5-200507060830)
I've got the results as expected:
0.112=>0.11
0.115=>0.12
0.105=>0.11
0.107=>0.11

But It's still a problem with (php4-STABLE-200507060848) on this
server. I'm try to reproduce problem on the same version of php on
other server (ALT Linux) and did not get any trouble. So it's seems to
be Fedora specific (IMHO)

------------------------------------------------------------------------

[2005-07-06 12:27:03] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip



------------------------------------------------------------------------

[2005-07-06 11:27:04] ruslan_y at list dot ru

Description:
------------
It's something wrong with round() and number_format() function on "new"
Fedora Core 4.

I'm try to compile php4.4.0RC2 on the same box but get just the same
result. 

Configure options:
'./configure' '--prefix=/usr/local' '--program-suffix=4'
'--with-config-file-path=/etc/php4' '--enable-memory-limit'
'--enable-versioning' '--enable-bcmath'
'--with-apxs=/usr/local/httpd/bin/apxs' '--disable-cgi'
'--enable-sigchild' '--with-zlib' '--enable-calendar' '--with-dom'
'--with-zlib-dir' '--with-dom-xslt' '--with-gd' '--with-jpeg-dir'
'--with-png-dir' '--with-ttf' '--with-freetype-dir'
'--enable-gd-native-ttf' '--with-iconv' '--with-mysql' '--with-oci8'
'--enable-xslt' '--with-xslt-sablot' '--with-expat' '--with-iconv-dir'
'--without-pear'

OS:
Linux - Linux localhost.localhost 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2
23:08:39 EDT 2005 i686

Automake: automake (GNU automake) 1.9.5
Autoconf: autoconf (GNU Autoconf) 2.59
Libtool: ltmain.sh (GNU libtool) 1.4.3 (1.922.2.111 2002/10/23
02:54:36)

Compiler:
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=i386-redhat-linux
Thread model: posix
gcc version 4.0.0 20050519 (Red Hat 4.0.0-8)

Bison: bison (GNU Bison) 2.0


Reproduce code:
---------------
<?php
echo "<br/>0.112=>".round(0.112, 2);
echo "<br/>0.115=>".round(0.115, 2);
echo "<br/>0.105=>".round(0.105, 2);
echo "<br/>0.107=>".round(0.107, 2);
?>

Expected result:
----------------
0.112=>0.11
0.115=>0.12
0.105=>0.11
0.107=>0.11

Actual result:
--------------
0.112=>0.11
0.115=>0.12
0.105=>0.1
0.107=>0.11


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33584&edit=1

Reply via email to