> But I don't want to do this!  I want to compare php numbers, which can be either 
>strings or floats,
> in php!  This already works fine when the php number is "passed" as a string, I just 
>want it to also
> work when it's passed as a float/double!

Which is not possible.

> floor(string(8.2 - 0.2)) == 8.)

Sure, this will work for exactly the same reason that 
floor(round(8.2 - 0.2) == 8.0) will work.  What you are implying is that 
we should always be doing an implicit round() which is not a good idea.  
This should be something that is up to the developer.

> So why doesn't php do this cast/round for me?  That's my question.

Because that would impose rounding errors and remove the develpor's 
flexibility for controlling this exactly.

-Rasmus


-- 
PHP Development 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]

Reply via email to