<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Rounding error when using constant raster in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658259#M51227</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a constant raster using the toolbox with value 1 (float)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following python code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;a = (Raster('myRaster') * 1.724)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;When I print the maximum/minimum of 'a', I get 1.72399997711&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also have a feeling that these rounding errors are causing some other problems in my script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I fix this without manually rounding every operation?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Feb 2012 15:38:25 GMT</pubDate>
    <dc:creator>JohnDoe1</dc:creator>
    <dc:date>2012-02-22T15:38:25Z</dc:date>
    <item>
      <title>Rounding error when using constant raster</title>
      <link>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658259#M51227</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I created a constant raster using the toolbox with value 1 (float)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have the following python code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;a = (Raster('myRaster') * 1.724)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;When I print the maximum/minimum of 'a', I get 1.72399997711&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I also have a feeling that these rounding errors are causing some other problems in my script.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I fix this without manually rounding every operation?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 15:38:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658259#M51227</guid>
      <dc:creator>JohnDoe1</dc:creator>
      <dc:date>2012-02-22T15:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error when using constant raster</title>
      <link>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658260#M51228</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;do a web search on &lt;/SPAN&gt;&lt;STRONG&gt;floating point representation&lt;/STRONG&gt;&lt;SPAN&gt; .&amp;nbsp; There is nothing you can do about it&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 15:49:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658260#M51228</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-02-22T15:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error when using constant raster</title>
      <link>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658261#M51229</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;do a web search on &lt;STRONG&gt;floating point representation&lt;/STRONG&gt; .&amp;nbsp; There is nothing you can do about it&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I thought it would be&amp;nbsp; some numerical error, but I'm wondering why&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;a = 1.724
b = 1.0 * 1.724
print b #=1.724&lt;/PRE&gt;&lt;SPAN&gt;does work, and my original code doesn't?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:51:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658261#M51229</guid>
      <dc:creator>JohnDoe1</dc:creator>
      <dc:date>2021-12-12T03:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Rounding error when using constant raster</title>
      <link>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658262#M51230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;because of floating point representation&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 20:25:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/rounding-error-when-using-constant-raster/m-p/658262#M51230</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2012-02-22T20:25:44Z</dc:date>
    </item>
  </channel>
</rss>

