Hello,
I remember there was a warning in the PHP Manual about
this. This is it:
** Never cast an unknown fraction to integer, as this
can sometimes lead to unexpected results.
** echo (int) ( (0.1+0.7) * 10 ); // echoes 7!
So do your calculations first, and then echo the
results. This way you get good habits in programming.
And your code will be easier to read as well!
Greetz,
Bjorn Van Simaeys
www.bvsenterprises.com
--- "[Intent A/S] Tais M. Hansen" <[EMAIL PROTECTED]>
wrote:
> 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:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]