<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Iterating over floats</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ab16bb93be/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ab16bb93be/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Engineering/thread/ab16bb93be/</id><updated>2020-02-27T14:48:40.649000Z</updated><subtitle>Recent posts to Iterating over floats</subtitle><entry><title>Iterating over floats</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/ab16bb93be/?limit=25#f45a" rel="alternate"/><published>2020-02-27T14:48:40.649000Z</published><updated>2020-02-27T14:48:40.649000Z</updated><author><name>Anonymous</name><uri>https://forge.codesys.com/u/*anonymous/</uri></author><id>https://forge.codesys.com1c73ef13bb1921c0f5eb3118d408d2a2c6a7e591</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;em&gt;Originally created by:&lt;/em&gt; M.Schaber&lt;/p&gt;
&lt;p&gt;(This is a rephrased example of a case which arrived via email.)&lt;/p&gt;
&lt;p&gt;Python has the range() and xrange() constructs to iterate over integers. However, there is no such construct for floats.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html" rel="nofollow"&gt;What Every Computer Scientist Should Know About Floating-Point Arithmetic&lt;/a&gt; by David Goldberg.&lt;/p&gt;
&lt;p&gt;You should also be aware that the FPU on the runtime might handle the precision and rounding different than the Python code on the developer PC, if you're about to compare floating point values between PC and runtime e. G. via monitoring.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://code.activestate.com/recipes/66472/" rel="nofollow"&gt;Recipe 66472&lt;/a&gt; in the &lt;a class="" href="http://code.activestate.com/recipes/langs/python/" rel="nofollow"&gt;Python Cookbook&lt;/a&gt;, or in the &lt;a class="" href="http://stackoverflow.com/questions/477486/python-decimal-range-step-value" rel="nofollow"&gt;Discussion on Stack Overflow&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>