Obviously, I am doing something wrong, and my code is too complex to repeat here. I have tried to distill the parts that seems pertinent. Anyone have any good ideas?
static void myfunc(unsigned char arr[], int n, int m) {
uint64_t nom = 255;
uint64_t den = arr[0];
uint64_t y = nom/den;//cause crashing
//uint64_t y = nom*den;//no problem
//uint64_t y = nom/42;//no problem
}
Windows platform:
Caught MathWorks::System::FatalException
OSX:
"MATLAB has encountered an internal problem and needs to close" (floating point exception detected)
The stack trace suggests my mex file calling libSystem.B.dylib, libmwmcr.dylib, libmwfl.dylib.
I am confused by the fact that I am able to "touch" the variable when doing multiplication, but as soon as I do a division, MATLAB seems to think that there is a floating point exception??