Re: Exception on a simple arithmetic problem
Re: Exception on a simple arithmetic problem
- Subject: Re: Exception on a simple arithmetic problem
- From: Jonas Maebe <email@hidden>
- Date: Fri, 20 Jan 2006 20:06:01 +0100
On 20 jan 2006, at 19:09, Cameron Hayne wrote:
double fVal, fTemp;
fTemp = filesize; /* filesize is a long long and is
greater than 0 */
fVal = 100.0 / (double) fTemp; /* EXC_ARITHMETIC happens here */
The debugger stop and throws EXC_ARITHMETIC message at the
calculation line. When the program is in release mode(compile with
-O2), this problem never happens during runtime. I am using OS
10.4.3 (8F1111).
What condition makes EXC_ARITHMETIC exception to be thrown under
Pentium ?
I suspect that a memory-allocation problem elsewhere has trashed
the 'filesize' variable such that it no longer contains a valid
numerical value. Try printing it out.
Also note that x86 fpu exceptions are not necessarily precise, unless
you add an "fwait" after each fpu operation (which I don't expect GCC
to do). It's possible that this exception was actually caused by the
previous fpu operation the program performed, but that it's triggered
here.
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden