--- In lpc2000@yahoogroups.com, "Karl Olsen" <kro@p...> wrote: > > ---- Original Message ---- > From: "soren_t_hansen" <soren_t_hansen@y...> > To: <lpc2000@yahoogroups.com> > Sent: Saturday, December 31, 2005 12:12 PM > Subject: [lpc2000] Divide by zero > > > What happenes if you make a division by zero on the LPC2132? I suspect > > that you enter the Undefined Instruction exception handler, but is > > that correct? I haven't been able to find anything about it in the > > manual. > > No, the ARM7TDMI does not have a hardware divide instruction, so divisions > are purely a software matter. > > With gcc, the compiler calls __divsi3 and __udivsi3 for signed and unsigned > integer divisions, and they are implemented in libgcc, a part of gcc. If > you try to divide by zero, they call __div0, and then return 0. The default > implementation of __div0 does nothing. > > Other compilers might handle it differently. > > Karl Olsen > I'm using the GNUARM toolchain. Does that mean that a divide by zero doesn't result in anything? /Søren
Message
Re: Divide by zero
2005-12-31 by soren_t_hansen
Attachments
- No local attachments were found for this message.