On Wed, 5 Sep 2001, Zeev Suraski wrote:
> >If the type of either operand is greater than long, it cannot be demoted
> >(from double) without overflowing lval and giving unexpected results.
>
> But when you overflow an integer, you get unexpected results. The only
> thing this code does is that in certain cases, where the lval would have
> been overflown and populated with meaningless info, instead, it populates
> it as if it's an unsigned long. If you use this information bitwise, then
> it's useful.
This is where the problem is coming in, and this is what would be
solved. Numbers over LONG_MAX are treated as doubles and cast to
unsigned long.
It doesn't solve the problem. That would involved one of two
things: people can only perform bitwise/mod on long ints or zval supports
precision arithmetic values. The latter would be a fair bit of work and
cost plenty of memory unless the BCMath precision support was extended to
bitwise (it currently solves the mod problem).
>
> >Instead, the relevant operations could be performed on unsigned longs,
> >with the result being cast to the most appropriate type (double or
> >long) based on whether op1 & op2 <= LONG_MAX.
>
> Can you give an example of something that doesn't work with the way the
> code is currently?
echo (2147483649 & 2147483649);
echo (2147483649 % 5);
etc.
>
> Zeev
>
Gavin
--
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]