Re: [PHP-DEV] [RFC] Integer Semantics

[email protected] (Andrea Faulds)
Newsgroups php.internals
Message-ID <[email protected]>
On 20 Aug 2014, at 06:52, Dmitry Stogov <[email protected]> wrote:

> 1) INF conversion to zero seems wrong. May be +INF should be converted to MAX_LONG and -INF to MIN_LONG?

I think of Infinity as more of an error value than an actual number. Not using MAX_LONG and MIN_LONG means it casts to the same value matter how large the integer type is, and it happens to be what JavaScript casts Infinity to. There’s also the fringe benefit that 1/0’s result in PHP, FALSE, casts to zero, as Infinity now would also, which is the standard IEEE 754 result for 1/0.

> 3) a bit unrelated, but it also may make sense to introduce a logical right shift operator (>>> in Java)

How would that function?
--
Andrea Faulds
http://ajf.me/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.