The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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: 358
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,

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


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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.