|
| From: | Paul Jarc |
| Subject: | Re: Bash arithmetic doesn't give error message on wrap. |
| Date: | Mon, 30 Apr 2007 16:36:50 -0400 |
| User-agent: | Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) |
Richard Neill <rn214@hermes.cam.ac.uk> wrote:
> I thought testing for overflow was quite simple?
> Isn't it just a case of looking at the carry-bit, and seeing whether it
> gets set?
That's usually how it's done in assembly. In C, it's somewhat more
compilcated. For example:
result=a*b;
if (result/a!=b) { report overflow; }
paul
| [Prev in Thread] | Current Thread | [Next in Thread] |