This is the wrong list to ask such a question, but I'll answer it
anyway since the answer might be of general interest.
There is a wonderful book Hacker's Delight by Henry S. Warren Jr.,
http://www.awprofessional.com/bookstore/product.asp?
isbn=0201914654redir=1rl=1
In some ways it can be
On May 30, 2005, at 02:57, Victor STINNER wrote:
I'm using gcc long long type for my calculator. I have to check
integer overflow. I'm using sign compare to check overflow, but it
doesn't work for 10^16 * 10^4 :
1 * 1
I see your question went unanswered, however I do
I definitely think that -fwrapv should be the default for
Ada.
On Fri, Jun 03, 2005 at 03:26:19PM -0400, Bradley Lucier wrote:
Assuming that overflow of signed integer arithmetic wraps (and what gcc
flag do I have to set to assume this?) then here is the algorithm to
multiply x and y with overflow detection.
Cast to unsigned; we are guaranteed that
Hi,
I'm using gcc long long type for my calculator. I have to check
integer overflow. I'm using sign compare to check overflow, but it
doesn't work for 10^16 * 10^4 :
1 * 1
Here you have my code to check overflow :
long long produit = a * b; // a,b: long long
bool ok;