This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Floating Point Exception in Integer Math?
- From: Jeffrey Walton <noloader at gmail dot com>
- To: GCC Users List <gcc-help at gcc dot gnu dot org>
- Date: Fri, 29 Jul 2011 15:39:37 -0400
- Subject: Floating Point Exception in Integer Math?
- Reply-to: noloader at gmail dot com
Hi All,
I'm testing signed int32 operations (division, modular reduction, and
overflow), and came across a floating point exception:
int32_t aa = INT32_MIN;
int32_t bb = -1;
int32_t rr = aa % bb;
cout << rr << " = " << aa << " % " << bb << endl;
There's not much to the command line: `g++ sitest.cpp -o sitest.exe`.
I was kind of surprised GCC [silently] moved from the integer domain
to the floating point domain.
Is this expected behavior?
Jeff