From: "Michael" <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: floating point calc differences between Matlab and C?
Date: Thu, 26 Mar 2009 02:38:01 +0000 (UTC)
Organization: Circular Logic
Lines: 16
Message-ID: <gqepq9$a43$>
References: <gqeaq9$56$> <OpAyl.3844$mF1.1542@newsfe23.iad>
Reply-To: "Michael" <>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1238035081 10371 (26 Mar 2009 02:38:01 GMT)
NNTP-Posting-Date: Thu, 26 Mar 2009 02:38:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1151890
Xref: comp.soft-sys.matlab:527810

> > Perhaps these are a result of the floating point rounding mode being used on the processor.
> >  Is there a way to check and set the floating point rounding mode from Matlab?
> Not on the Mac, not without writing some MEX to do it for you.
> There is a system_dependant() call that [if I recall correctly] can do some
> things with the rounding modes for MS Windows.

Thanks Walter. When you say writing some MEX code to do it, do you mean a MEX file code effect the floating point rounding mode of MATLAB as it's running, or do you mean being able to change the rounding mode within the C code running as the MEX file?

I couldn't find how to do it in gcc. Do you know how?

Thanks again.