RE: [PHP] Bug?

From: Date: Thu, 01 Jan 1970 00:00:00 +0000
Subject: RE: [PHP] Bug?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61784@lists.php.net to get a copy of this message
Btw. floor((8.85-8)*100) == (int)((8.85-8)*100) And if you gonna using integer numbers, it is always good idea to use one of rounding functions: round, ceil or floor. In this case round works as expected. Regards, -- Darius Ivanauskas On Wed, 8 Aug 2001, Darius Ivanauskas wrote: > Hello, > > You shodld read > http://www.php.net/manual/en/language.types.double.php and > > http://www.php.net/manual/en/language.types.integer.php#language.types.integer.casting > > > Regards, > -- > Darius Ivanauskas > > On Wed, 8 Aug 2001, Maxim Maletsky wrote: > > > good point. > > > > ...and try this out: > > > > > > echo (int)((8.85-8)*100).'<br>'; > > echo ((8.85-8)*100).'<br>'; > > > > > > Kinda weird, > > can anyone explain? > > > > > > Thanks, > > Maxim Maletsky > > > > > > > > -----Original Message----- > > From: [Intent A/S] Tais M. Hansen [mailto:tmh@intent.dk] > > Sent: Wednesday, August 08, 2001 4:49 PM > > To: php-general@lists.php.net > > Subject: [PHP] Bug? > > > > > > Hi! > > > > I just came across this weird thing. Bug? You tell me! > > > > print (int)((8.85-8)*100); > > > > I would think the line above would print "85". But for some reason, it > > prints "84"?? Can anyone tell me why that is? > > > > -- > > Intent A/S > > Tais M. Hansen > > Web Developer > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#61784) next »