poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: integer overflow in muli instruction


From: Jose E. Marchesi
Subject: Re: integer overflow in muli instruction
Date: Tue, 23 Feb 2021 10:04:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>>> But then, at this point we have to decide what semantics to implement in
>>> Poke when signed overflow happens (in multiplication, division, etc).
>>> 
>>> Adopting C semantics, and raising a Poke exception seems to be the most
>>> obvious choice...
>>
>> Yes, this seems the right thing to do. The programmer can then decide
>> whether they want to use a 64-bit type or an unsigned type as a workaround.
>
> All right, poke now checks for overflows in:
>
> - Signed addition.
> - Signed subtraction.
> - Signed multiplication.
> - Signed division.
> - Signed ceil division.
> - Signed remainder.
> - Signed Negation.
>
> At both run-time (exception E_overflow) and compile-time (constant
> folding).

Just added:

- Signed exponentiation.

So I think at this point we are good when it comes to detecting overflow
in signed operations.

Salud!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]