For addition, overflow is easy: Keep track of the sign bits of the inputs and output and do a little logic. (Overflow if the A and B have the same sign, while C has a different sign.)
For subtract, we compute the 1's complement of B and then add with a carry in. If we compute overflow based on B's sign after the 1's complement, is that mathematically the same? I think the one place where this could go wrong is if we subtract zero and don't consider that the sign doesn't change, but I can special-case that. -- Timothy Normand Miller, PhD Assistant Professor of Computer Science, Binghamton University http://www.cs.binghamton.edu/~millerti/ Open Graphics Project
_______________________________________________ Open-graphics mailing list [email protected] http://lists.duskglow.com/mailman/listinfo/open-graphics List service provided by Duskglow Consulting, LLC (www.duskglow.com)
