<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Rounding Results</title>
	<atom:link href="http://blogs.mathworks.com/loren/2009/09/03/rounding-results/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/</link>
	<description>Loren Shure works on design of the MATLAB language at MathWorks. She writes here about once a week on MATLAB programming and related topics.</description>
	<lastBuildDate>Thu, 09 Feb 2012 04:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-32086</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 08 Mar 2011 20:06:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-32086</guid>
		<description>Mark-

I suspect it&#039;s never been added because it&#039;s not too hard to write the code, and I don&#039;t think very many people have requested it.  If you would like to see a version shipping with MATLAB, use the link on the right of my blog to contact technical support and put in your plea for an enhancement.  

Finally, you can check out the File Exchange.  When I searched for rounding or rounding significant, I found quite a few possible solutions (with some other stuff also mixed in.

--Loren</description>
		<content:encoded><![CDATA[<p>Mark-</p>
<p>I suspect it&#8217;s never been added because it&#8217;s not too hard to write the code, and I don&#8217;t think very many people have requested it.  If you would like to see a version shipping with MATLAB, use the link on the right of my blog to contact technical support and put in your plea for an enhancement.  </p>
<p>Finally, you can check out the File Exchange.  When I searched for rounding or rounding significant, I found quite a few possible solutions (with some other stuff also mixed in.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-32085</link>
		<dc:creator>Mark</dc:creator>
		<pubDate>Tue, 08 Mar 2011 19:46:37 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-32085</guid>
		<description>Why does MatLab not have a floating point rounding function to round to 1 - 6 places to the right of the decimal point?

I had to write my own and using the basic (x*10^n/10^n) where n is the number of decimal places does not work reliably (round numbers like 3.44545 to one decimal place 3.5)</description>
		<content:encoded><![CDATA[<p>Why does MatLab not have a floating point rounding function to round to 1 &#8211; 6 places to the right of the decimal point?</p>
<p>I had to write my own and using the basic (x*10^n/10^n) where n is the number of decimal places does not work reliably (round numbers like 3.44545 to one decimal place 3.5)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30933</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 04 Jan 2010 14:05:27 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30933</guid>
		<description>Drazick, OysterEngineer, and possibly others,

Because of the nature of floating point arithmetic, getting exactly zero every time is not possible unless perhaps you can control every aspect of the calculations, order, whether on the stack, etc.  In which case, MATLAB is possibly not the best tool if you override all operations.

--Loren</description>
		<content:encoded><![CDATA[<p>Drazick, OysterEngineer, and possibly others,</p>
<p>Because of the nature of floating point arithmetic, getting exactly zero every time is not possible unless perhaps you can control every aspect of the calculations, order, whether on the stack, etc.  In which case, MATLAB is possibly not the best tool if you override all operations.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Drazick</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30919</link>
		<dc:creator>Drazick</dc:creator>
		<pubDate>Mon, 28 Dec 2009 18:10:05 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30919</guid>
		<description>Loren,
I agree with OysterEngineer.
Sometimes, because of finite accuracy of Matlab I get results such as 3E-16. I want it to be exactly 0. It would be nice to such function.

Though it can be done by round.

Thanks.</description>
		<content:encoded><![CDATA[<p>Loren,<br />
I agree with OysterEngineer.<br />
Sometimes, because of finite accuracy of Matlab I get results such as 3E-16. I want it to be exactly 0. It would be nice to such function.</p>
<p>Though it can be done by round.</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30710</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 28 Oct 2009 11:43:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30710</guid>
		<description>OysterEngineer-

I recommend you use the support link on the right to enter your suggestion for round.  Suggestions directly from customers tend to carry more weight.  Thanks.

--Loren</description>
		<content:encoded><![CDATA[<p>OysterEngineer-</p>
<p>I recommend you use the support link on the right to enter your suggestion for round.  Suggestions directly from customers tend to carry more weight.  Thanks.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OysterEngineer</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30708</link>
		<dc:creator>OysterEngineer</dc:creator>
		<pubDate>Tue, 27 Oct 2009 20:49:30 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30708</guid>
		<description>The illustrates why MatLab needs a smarter round function, much like even lowly Excel has, where the user can specify the number of digits to which you want to round to.</description>
		<content:encoded><![CDATA[<p>The illustrates why MatLab needs a smarter round function, much like even lowly Excel has, where the user can specify the number of digits to which you want to round to.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30647</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 28 Sep 2009 15:55:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30647</guid>
		<description>Craig-

I&#039;m glad rounding works for you.  Are you rounding to tenths for your work?  Is your target value always in in tenths?  Another possibility is to check if the calculated value is within a certain distance from the spec (e.g., abs(spec-calc) &lt; SomeTolerance).

--Loren</description>
		<content:encoded><![CDATA[<p>Craig-</p>
<p>I&#8217;m glad rounding works for you.  Are you rounding to tenths for your work?  Is your target value always in in tenths?  Another possibility is to check if the calculated value is within a certain distance from the spec (e.g., abs(spec-calc) < SomeTolerance).</p>
</p><p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Miller</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30608</link>
		<dc:creator>Craig Miller</dc:creator>
		<pubDate>Mon, 14 Sep 2009 19:39:20 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30608</guid>
		<description>Loren,
I use rounding for calculations and comparisions with specification limits.  For example if the lower spec limit is 1.8 and the calculated value is 1.78254343 I want this value to pass because it rounds to 1.8 which is not less than the specification limit.  This may not be &#039;correct&#039; but it&#039;s the way we&#039;ve done our spec checking since time immemorial (in computer terms anyway).
Craig</description>
		<content:encoded><![CDATA[<p>Loren,<br />
I use rounding for calculations and comparisions with specification limits.  For example if the lower spec limit is 1.8 and the calculated value is 1.78254343 I want this value to pass because it rounds to 1.8 which is not less than the specification limit.  This may not be &#8216;correct&#8217; but it&#8217;s the way we&#8217;ve done our spec checking since time immemorial (in computer terms anyway).<br />
Craig</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30576</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 08 Sep 2009 11:07:43 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30576</guid>
		<description>Ben-

Obviously you still need to be aware of numerical round-off in the calculations done before rounding in the first place.  And using floor instead of round may not be what you want to do.

--Loren</description>
		<content:encoded><![CDATA[<p>Ben-</p>
<p>Obviously you still need to be aware of numerical round-off in the calculations done before rounding in the first place.  And using floor instead of round may not be what you want to do.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30575</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Tue, 08 Sep 2009 02:12:29 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/2009/09/03/rounding-results/#comment-30575</guid>
		<description>&lt;pre&gt;
&gt;&gt; floor(22*(15/22))
ans =
    14

&gt;&gt; floor(49*(1/49))
ans =
     0
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<pre>
&gt;&gt; floor(22*(15/22))
ans =
    14

&gt;&gt; floor(49*(1/49))
ans =
     0
</pre>
]]></content:encoded>
	</item>
</channel>
</rss>

