Re: Re: PHP 4.0 Bug #6220 Updated: floor((0.7+0.1)*10) wrong

From: Date: Fri, 18 Aug 2000 11:38:21 +0000
Subject: Re: Re: PHP 4.0 Bug #6220 Updated: floor((0.7+0.1)*10) wrong
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-29390@lists.php.net to get a copy of this message
the bcmath functions, see documentation :). Sterling > > ID: 6220 > > Updated by: hholzgra > > Reported By: rockojfonzo@gmx.net > > Status: Closed > > Bug Type: Misbehaving function > > Assigned To: > > Comments: > > > > (and it's the same in C) > > > > this is related to binary float > > representation in microprocessors > > > > 7 and .1 are periodic fractions > > in binary system so you get minimal > > rounding errors > > > > so (0.7+0.1)*10) will result in something > > almost 8.0 but with a minimal positive or negative > > offset > > > > this usualy dosn't matter as rounding will be > > applied but it does matter for floor() as in this > > case the result is a very little less than 8 > > > > conclusion: if you need the precisision than use bc > I´m sorry, what do you mean by "bc"? > > -- > Regards > > Ron > > Sent through GMX FreeMail - http://www.gmx.net > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > >

« previous php.dev (#29390) next »