Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Loss of information using small numbers (e-10), MEX, C++
Replies: 7   Last Post: Dec 30, 2013 11:53 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Phil Goddard

Posts: 348
Registered: 1/27/12
Re: Loss of information using small numbers (e-10), MEX, C++
Posted: Dec 30, 2013 11:53 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


> > 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?
>


I didn't say it was a compiler error, merely that some compilers may define a long double to be the same as a double.
See for instance, http://msdn.microsoft.com/en-us/library/s3f49ktz.aspx

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).

Phil.



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.