<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263866</link>
    <title>MATLAB Central Newsreader - Logical error</title>
    <description>Feed for thread: Logical error</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 22 Oct 2009 14:50:22 -0400</pubDate>
      <title>Logical error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263866#689033</link>
      <author>Andrew </author>
      <description>I am getting a logical error with the following code which I don't understand and would appreciate any help figuring out:&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; n=0.6:0.05:2.0;&lt;br&gt;
&amp;gt;&amp;gt; any(n==1.2)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;0&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; any(n==1.0)&lt;br&gt;
&lt;br&gt;
ans =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;1&lt;br&gt;
&lt;br&gt;
I can check all of the values in n and only the value of 1.2 returns false.  I would appreciate any help figuring this one out.  Thanks.  </description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 15:41:21 -0400</pubDate>
      <title>Re: Logical error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263866#689051</link>
      <author>Matt </author>
      <description>&quot;Andrew &quot; &amp;lt;apkelley@princeton.edu&amp;gt; wrote in message &amp;lt;hbprfe$lvf$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I am getting a logical error with the following code which I don't understand and would appreciate any help figuring out:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; n=0.6:0.05:2.0;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; any(n==1.2)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;      0&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; any(n==1.0)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; ans =&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;      1&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I can check all of the values in n and only the value of 1.2 returns false.  I would appreciate any help figuring this one out.  Thanks.  &lt;br&gt;
&lt;br&gt;
FAQ. The values of of n are not exact, because there are floating point errors in generating them.  It's pure luck that any of them return the expected result.</description>
    </item>
    <item>
      <pubDate>Thu, 22 Oct 2009 16:04:20 -0400</pubDate>
      <title>Re: Logical error</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/263866#689059</link>
      <author>Matt Fig</author>
      <description>&lt;a href=&quot;http://matlabwiki.mathworks.com/MATLAB_FAQ#Why_is_0.3-0.2-0.1_not_equal_to_zero_.28or_similar.29.3F&quot;&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ#Why_is_0.3-0.2-0.1_not_equal_to_zero_.28or_similar.29.3F&lt;/a&gt;</description>
    </item>
  </channel>
</rss>

