say, given the limit of the unsigned as k bits. Find log to base 2^k. If it's one in both, it'll result in an overflow. ---------- Forwarded message ---------- From: aravind kumar <[EMAIL PROTECTED]> Date: Jan 24, 2007 7:10 PM Subject: [algogeeks] Re: the sum of two unsigned integers To: algogeeks@googlegroups.com
check if the sum is less than any of the two numbers that means the sum resulted in a overflow. On 1/24/07, Abid <[EMAIL PROTECTED]> wrote: > > > This is an interview question. > What is the simples way to check if the sum of two unsigned integers > has resulted in an overflow. ? > > > -- Regards Aravind "Too often we underestimate the power of a touch, a smile, a kind word, a listening ear, an honest compliment, or the smallest act of caring, all of which have the potential to turn a life around." "Do I contradict myself? Very well then I contradict myself, I am large, I contain multitudes." - Walt Whitman -- Santhosh S ME05B045 Dept. of Mechanical Engineering, IIT Madras, Chennai-600036 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups-beta.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---