<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Index a Table with a float?</title>
    <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Sat, 13 Jun 2026 18:20:25 GMT</lastBuildDate>
    <pubDate>Sat, 13 Jun 2026 18:20:25 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Index a Table with a float?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Index a Table with a float?</title>
      <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float</link>
    </image>
    <item>
      <title>rationals</title>
      <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float?ref=Feed:MaplePrimes:Index a Table with a float?:Comments#answer44834</link>
      <itunes:summary>&lt;p&gt;You could avoid the issue by using rationals, say 1/10 or 1/20.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;You could avoid the issue by using rationals, say 1/10 or 1/20.&lt;/p&gt;</description>
      <guid>44834</guid>
      <pubDate>Tue, 16 Feb 2010 07:48:43 Z</pubDate>
      <itunes:author>Joe
 Riel
</itunes:author>
      <author>Joe
 Riel
</author>
    </item>
    <item>
      <title>floats</title>
      <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float?ref=Feed:MaplePrimes:Index a Table with a float?:Comments#answer44835</link>
      <itunes:summary>&lt;p&gt;As your examples show, it's generally a bad idea to use floats to index a table, because of this issue (and others involving roundoff error).&amp;nbsp; &lt;br /&gt;
But you might use this procedure to remove trailing zeros from a float:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; RemoveTrailingZeros:= proc(x) local S; S:= sprintf(&amp;quot;%s0.%dg&amp;quot;,&amp;quot;%&amp;quot;,Digits); parse(sprintf(S,x)); end proc;
&lt;/pre&gt;
&lt;p&gt;&amp;gt; RemoveTrailingZeros(0.20);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;As your examples show, it's generally a bad idea to use floats to index a table, because of this issue (and others involving roundoff error).&amp;nbsp; &lt;br /&gt;
But you might use this procedure to remove trailing zeros from a float:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; RemoveTrailingZeros:= proc(x) local S; S:= sprintf(&amp;quot;%s0.%dg&amp;quot;,&amp;quot;%&amp;quot;,Digits); parse(sprintf(S,x)); end proc;
&lt;/pre&gt;
&lt;p&gt;&amp;gt; RemoveTrailingZeros(0.20);&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.2&lt;/p&gt;</description>
      <guid>44835</guid>
      <pubDate>Tue, 16 Feb 2010 12:23:48 Z</pubDate>
      <itunes:author>Robert Israel</itunes:author>
      <author>Robert Israel</author>
    </item>
    <item>
      <title>Thanks!  I use</title>
      <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float?ref=Feed:MaplePrimes:Index a Table with a float?:Comments#answer44836</link>
      <itunes:summary>&lt;p&gt;Thanks!&amp;nbsp; I use convert(...,rational) frequently, but removing zeros is a good idea, too.&amp;nbsp; I wonder what Maple is doing internally, since evalb(0.2=0.20) returns true....evalb([0.2]=[0.20]) is false, so as the index and table gets built, equality is harder to come by...&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks!&amp;nbsp; I use convert(...,rational) frequently, but removing zeros is a good idea, too.&amp;nbsp; I wonder what Maple is doing internally, since evalb(0.2=0.20) returns true....evalb([0.2]=[0.20]) is false, so as the index and table gets built, equality is harder to come by...&lt;/p&gt;</description>
      <guid>44836</guid>
      <pubDate>Tue, 16 Feb 2010 22:58:08 Z</pubDate>
      <itunes:author>ihayles</itunes:author>
      <author>ihayles</author>
    </item>
    <item>
      <title>Equality</title>
      <link>http://www.mapleprimes.com/questions/35715-Index-A-Table-With-A-Float?ref=Feed:MaplePrimes:Index a Table with a float?:Comments#comment44837</link>
      <itunes:summary>&lt;p&gt;For numeric quantities, Maple compares the numeric values.&amp;nbsp; For other quantities Maple generally compares addresses. So two lists of numerics are equal only if they are the same list.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;For numeric quantities, Maple compares the numeric values.&amp;nbsp; For other quantities Maple generally compares addresses. So two lists of numerics are equal only if they are the same list.&lt;/p&gt;</description>
      <guid>44837</guid>
      <pubDate>Tue, 16 Feb 2010 23:20:29 Z</pubDate>
      <itunes:author>Joe
 Riel
</itunes:author>
      <author>Joe
 Riel
</author>
    </item>
  </channel>
</rss>