<?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: A Glimpse into Floating-Point Accuracy</title>
	<atom:link href="http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/</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: Chris Pap</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-32611</link>
		<dc:creator>Chris Pap</dc:creator>
		<pubDate>Wed, 09 Nov 2011 16:47:02 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-32611</guid>
		<description>Thank you!</description>
		<content:encoded><![CDATA[<p>Thank you!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-32610</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Wed, 09 Nov 2011 16:40:22 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-32610</guid>
		<description>Chris-

You must indeed have a complex valued minimum.  You need to check out your objective function carefully, make sure it can&#039;t be called out of range, is normalized correctly, there can be no accumulation of small imaginary parts that could build up, etc.

--Loren</description>
		<content:encoded><![CDATA[<p>Chris-</p>
<p>You must indeed have a complex valued minimum.  You need to check out your objective function carefully, make sure it can&#8217;t be called out of range, is normalized correctly, there can be no accumulation of small imaginary parts that could build up, etc.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Pap</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-32609</link>
		<dc:creator>Chris Pap</dc:creator>
		<pubDate>Wed, 09 Nov 2011 16:23:21 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-32609</guid>
		<description>Hello there, I have this question.
While calculating sums of squares during a minimization routine, I end up with numbers of the form 0.002+0.203i.
Is this some special format? Or have I managed to produce
a ...complex valued minimum for my problem? 
(Which will either make me famous or embarassed).

 Thank you for your time.</description>
		<content:encoded><![CDATA[<p>Hello there, I have this question.<br />
While calculating sums of squares during a minimization routine, I end up with numbers of the form 0.002+0.203i.<br />
Is this some special format? Or have I managed to produce<br />
a &#8230;complex valued minimum for my problem?<br />
(Which will either make me famous or embarassed).</p>
<p> Thank you for your time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-32449</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Mon, 29 Aug 2011 11:40:53 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-32449</guid>
		<description>nablaQuadrat-

Could you please explain what you mean about the issue of under- and over-flow not being solved?  MATLAB conforms to the IEEE standard and does what the standard says, to the best of my knowledge.

--Loren</description>
		<content:encoded><![CDATA[<p>nablaQuadrat-</p>
<p>Could you please explain what you mean about the issue of under- and over-flow not being solved?  MATLAB conforms to the IEEE standard and does what the standard says, to the best of my knowledge.</p>
<p>&#8211;Loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nablaQuadrat</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-32447</link>
		<dc:creator>nablaQuadrat</dc:creator>
		<pubDate>Sun, 28 Aug 2011 14:51:39 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-32447</guid>
		<description>Just a critical remark.
When I used a Borland compiler round 1995, it knew the data type &quot;extended&quot; which let us store a number from 1E-500 to 1E2000.
In Maple, which is also less expensive than Matlab, it is possible to increase the precision to a virtually arbitrary accuracy.

Why is that, that Matlab ( which costs at least as much as Maple and advertises itself to be a &quot;numerical laboratorium&quot; in contrast to Maple, which is a symbolic engine ) is the issue of under- and overflow not solved satisfactionary in 2011 ?! I am quite pissed off.</description>
		<content:encoded><![CDATA[<p>Just a critical remark.<br />
When I used a Borland compiler round 1995, it knew the data type &#8220;extended&#8221; which let us store a number from 1E-500 to 1E2000.<br />
In Maple, which is also less expensive than Matlab, it is possible to increase the precision to a virtually arbitrary accuracy.</p>
<p>Why is that, that Matlab ( which costs at least as much as Maple and advertises itself to be a &#8220;numerical laboratorium&#8221; in contrast to Maple, which is a symbolic engine ) is the issue of under- and overflow not solved satisfactionary in 2011 ?! I am quite pissed off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Loren</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-31642</link>
		<dc:creator>Loren</dc:creator>
		<pubDate>Tue, 07 Sep 2010 15:30:58 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-31642</guid>
		<description>Naveen-

See this comment: http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-29617 for mantissa, etc. details.

--loren</description>
		<content:encoded><![CDATA[<p>Naveen-</p>
<p>See this comment: <a href="http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-29617" rel="nofollow">http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-29617</a> for mantissa, etc. details.</p>
<p>&#8211;loren</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naveen Kumar</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-31641</link>
		<dc:creator>Naveen Kumar</dc:creator>
		<pubDate>Tue, 07 Sep 2010 15:13:45 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-31641</guid>
		<description>As mentioned by Loren Matlab uses 56 bits for mantisa. Can you please answer, How many bits are used for exponent, and what is the base is it just 2, or 16, or something else.
I tested the following code, hoping mantisa would become zero, but it doesn&#039;t.
Can you pl comment?

n = 1;
for i = 1:1000
    n = n *(1/2)
end</description>
		<content:encoded><![CDATA[<p>As mentioned by Loren Matlab uses 56 bits for mantisa. Can you please answer, How many bits are used for exponent, and what is the base is it just 2, or 16, or something else.<br />
I tested the following code, hoping mantisa would become zero, but it doesn&#8217;t.<br />
Can you pl comment?</p>
<p>n = 1;<br />
for i = 1:1000<br />
    n = n *(1/2)<br />
end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arda</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-30058</link>
		<dc:creator>arda</dc:creator>
		<pubDate>Mon, 23 Feb 2009 20:21:09 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-30058</guid>
		<description>Steve,
Thanks for the help. For a footnote, I investigated the trigonometric errors for both correct and incorrect values. It turns out to be coincidence of correct values (not incorrect ones) :)</description>
		<content:encoded><![CDATA[<p>Steve,<br />
Thanks for the help. For a footnote, I investigated the trigonometric errors for both correct and incorrect values. It turns out to be coincidence of correct values (not incorrect ones) :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve L</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-30056</link>
		<dc:creator>Steve L</dc:creator>
		<pubDate>Mon, 23 Feb 2009 14:14:40 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-30056</guid>
		<description>arda,

The coefficient C3 used by FDLIBM&#039;s implementation of COS is NOT exactly 1/factorial(8).  See this Cleve&#039;s Corner article for a discussion of how the FDLIBM implementation of SIN was designed; the implementation of COS was designed in much the same way.

http://www.mathworks.com/company/newsletters/news_notes/clevescorner/winter02_cleve.html

Quoting from that article:

&lt;i&gt;The six coefficients are close to, but not exactly equal to, the power series coefficients 1/3!, 1/5!, …, 1/13! . They minimize the maximum relative error, &#124; (sin() - p())/sin() &#124;, over the interval. Six terms are enough to make this approximation error less than 2^(-52), which is the roundoff error involved when all the terms, and the sum, are less than one.&lt;/i&gt;

That article is titled &quot;The Tetragamma Function and Numerical Craftsmanship&quot; -- and there&#039;s definitely some craftmanship involved in the implementation of the trig functions.</description>
		<content:encoded><![CDATA[<p>arda,</p>
<p>The coefficient C3 used by FDLIBM&#8217;s implementation of COS is NOT exactly 1/factorial(8).  See this Cleve&#8217;s Corner article for a discussion of how the FDLIBM implementation of SIN was designed; the implementation of COS was designed in much the same way.</p>
<p><a href="http://www.mathworks.com/company/newsletters/news_notes/clevescorner/winter02_cleve.html" rel="nofollow">http://www.mathworks.com/company/newsletters/news_notes/clevescorner/winter02_cleve.html</a></p>
<p>Quoting from that article:</p>
<p><i>The six coefficients are close to, but not exactly equal to, the power series coefficients 1/3!, 1/5!, …, 1/13! . They minimize the maximum relative error, | (sin() &#8211; p())/sin() |, over the interval. Six terms are enough to make this approximation error less than 2^(-52), which is the roundoff error involved when all the terms, and the sum, are less than one.</i></p>
<p>That article is titled &#8220;The Tetragamma Function and Numerical Craftsmanship&#8221; &#8212; and there&#8217;s definitely some craftmanship involved in the implementation of the trig functions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arda</title>
		<link>http://blogs.mathworks.com/loren/2006/08/23/a-glimpse-into-floating-point-accuracy/#comment-30054</link>
		<dc:creator>arda</dc:creator>
		<pubDate>Mon, 23 Feb 2009 10:07:53 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.mathworks.com/loren/?p=51#comment-30054</guid>
		<description>Thanks for the reply,
I&#039;m interested in cos() errors in Matlab and wanted to see the major error. I know these errors are mostly because floating points, and they are all look like floating point errors;
&gt;&gt; x=0:1/2^15:0.3;
&gt;&gt; plot(x,cos(x).^2+sin(x).^2-1,&#039;.&#039;)

But i do want to see the exact reason for every number and then maybe come up with a solution. See i also found some interesting things;

Take a look at the cos() function which is said to be used in Matlab. I have cross checked and ensure that this is the code Matlab uses (http://www.netlib.org/fdlibm/k_cos.c). 
Inside the code the constants are given as forexample C3=2.48015872894767294178e-05 and this is 1/8! (http://en.wikipedia.org/wiki/Cosine). However the difference is;
&gt;&gt; 1/factorial(8)-2.48015872894767294178e-05
ans =
  1.2111e-014

These are clearly different numbers! And what is more interesting is that errors appear more when i try to use exact factorial values. Even with higher series..</description>
		<content:encoded><![CDATA[<p>Thanks for the reply,<br />
I&#8217;m interested in cos() errors in Matlab and wanted to see the major error. I know these errors are mostly because floating points, and they are all look like floating point errors;<br />
&gt;&gt; x=0:1/2^15:0.3;<br />
&gt;&gt; plot(x,cos(x).^2+sin(x).^2-1,&#8217;.')</p>
<p>But i do want to see the exact reason for every number and then maybe come up with a solution. See i also found some interesting things;</p>
<p>Take a look at the cos() function which is said to be used in Matlab. I have cross checked and ensure that this is the code Matlab uses (<a href="http://www.netlib.org/fdlibm/k_cos.c" rel="nofollow">http://www.netlib.org/fdlibm/k_cos.c</a>).<br />
Inside the code the constants are given as forexample C3=2.48015872894767294178e-05 and this is 1/8! (<a href="http://en.wikipedia.org/wiki/Cosine" rel="nofollow">http://en.wikipedia.org/wiki/Cosine</a>). However the difference is;<br />
&gt;&gt; 1/factorial(8)-2.48015872894767294178e-05<br />
ans =<br />
  1.2111e-014</p>
<p>These are clearly different numbers! And what is more interesting is that errors appear more when i try to use exact factorial values. Even with higher series..</p>
]]></content:encoded>
	</item>
</channel>
</rss>

