This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Floating Point Exception in Integer Math?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]