Jump to content

problems with floating point


gudushen

Recommended Posts

Hi there,

 

I don't know why but my floating point is displaying incorrectly.

 

this is all i did,

 

<?php
$a = 0.5;
echo "a is $a";
?>

 

the browser simply loads forever and eventually fails.

 

if i change $a to something like 0.523, then it displays "a is 0"

if i change $a to 0.53, i get "a is -7.187271;8963E-235" ??????

 

hows that even possible :o

 

if anyone know why this is happening please let me know.

thanks

 

EDITED BY akitchin: please use code tags in all future posts.

Link to comment
https://forums.phpfreaks.com/topic/166122-problems-with-floating-point/
Share on other sites

That's incredibly odd... What server are you using?

 

i'm not to sure, this is what i got from phpinfo, hope that helps.

 

PHP Version 5.2.6

 

System Linux OpenWrt 2.6.26.5 #69 Fri Jun 26 13:38:04 EDT 2009 mips

Build Date May 17 2009 08:28:36

Configure Command './configure' '--target=mips-linux' '--host=mips-linux' '--build=x86_64-linux-gnu' '--program-prefix=' '--program-suffix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share' '--localstatedir=/var' '--mandir=/usr/man' '--infodir=/usr/info' '--disable-nls' '--enable-shared' '--disable-static' '--disable-rpath' '--disable-debug' '--without-pear' '--disable-spl' '--with-config-file-path=/etc' '--disable-ipv6' '--enable-magic-quotes' '--enable-memory-limit' '--disable-short-tags' '--disable-ctype' '--disable-dom' '--enable-ftp=shared' '--without-gettext' '--without-iconv' '--disable-libxml' '--without-libxml-dir' '--disable-xmlreader' '--disable-xmlwriter' '--disable-mbstring' '--disable-mbregex' '--with-openssl=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-kerberos=no' '--with-openssl-dir=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--enable-session=shared' '--disable-simplexml' '--disable-soap' '--enable-sockets=shared' '--disable-tokenizer' '--with-zlib=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-zlib-dir=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--disable-filter' '--with-curl=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-gd=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--without-freetype-dir' '--with-jpeg-dir=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-png-dir=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--without-xpm-dir' '--without-ttf' '--without-t1lib' '--enable-gd-native-ttf' '--disable-gd-jis-conv' '--with-gmp=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-ldap=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-ldap-sasl=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-mysql=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-pcre-regex=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-pgsql=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-sqlite=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--enable-pdo=shared' '--with-pdo-sqlite=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--enable-xml=shared,/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--with-libexpat-dir=/home/andy/openwrt/ar71xx/staging_dir/mips/usr' '--enable-apc' '--disable-apc-mmap' '--disable-apc-pthreadmutex' '--enable-exif' '--disable-cli' '--enable-cgi' '--disable-fastcgi' '--enable-force-cgi-redirect' '--enable-discard-path'

Server API CGI

Virtual Directory Support disabled

Configuration File (php.ini) Path /etc

Loaded Configuration File /etc/php.ini

PHP API 20041225

PHP Extension 20060613

Zend Extension 220060519

Debug Build no

Thread Safety disabled

Zend Memory Manager enabled

IPv6 Support disabled

Registered PHP Streams php, file, data, http, ftp, compress.zlib

Registered Stream Socket Transports tcp, udp, unix, udg

Registered Stream Filters string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, zlib.*

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.