> > Some compilers define long double as the same as double, so you may not be getting what you expect. > > Do you mean that you expect this to be a compiler error? Why do you think the problem is with the long doubles? >
Since the OP is using gcc this is most likely not the issue.
> > Also, mxGetPr points to double, so you should be casting to a long double before writing to kappa, betaN etc. > > The compiler will do these type conversions automatically as part of the assignment.
You assume it will, and are most likely right, where as making it explicit in the code makes it more understandable (IMHO).