Re: Weird calculations

From: Date: Tue, 27 May 2003 11:58:21 +0000
Subject: Re: Weird calculations
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149088@lists.php.net to get a copy of this message
On Tuesday 27 May 2003 19:50, Marek Bialoglowy wrote: [snip] > what shows result "0.97790000000001". Well from what I know result of > 103.7916-102.8137 should always be 0.9779, right ? So what is the problem ? > Certailny if I will change echo "$changed_value"; to > printf("%8.4f",$change_value); everything will be > fine, but I am just > wondering why I get this wrong result in first place ? Floating point rounding errors. Unavoidable. Use the bcmath functions instead. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* Some changes are so slow, you don't notice them. Others are so fast, they don't notice you. */

« previous php.general (#149088) next »