I was wondering why objects are always converted to longs when performing arithmetic.

While looking at bug 42780: http://bugs.php.net/bug.php?id=42780
The only way not to lose precision is to explicitly cast the object to float or string, which just doesn't seem right to me. It would be nice if there was an object handler like to_numeric where an object could determine what type of numeric to return, or some other way for this to happen. This would then allow it to work like performing math on strings. When is_numeric string is called, it is properly to converted to either a double or long so precision is not lost.

Rob

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to