On Wed, Aug 20, 2014 at 1:20 PM, Andrea Faulds <a...@ajf.me> wrote:

>
> On 20 Aug 2014, at 06:52, Dmitry Stogov <dmi...@zend.com> 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)
>

The difference between "arithmetic" and "logical" shift is sign propagation.

0x10000000 >> 1 == 0x11000000

0x10000000 >>> 1 == 0x01000000

In C the same >> operator perform "arithmetic" shift for signed numbers and
"logical" shift for unsigned.

Thanks. Dmitry.



>
> How would that function?
> --
> Andrea Faulds
> http://ajf.me/
>
>
>
>
>

Reply via email to