<?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 Re: num() rounds differently to round() for half-step values in Archived Groups</title>
    <link>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541460#M4243</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;However, results seems to be also version related. And now I get even different results than as I've posted the original post a few month ago..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Nov 2013 07:10:03 GMT</pubDate>
    <dc:creator>rbecher</dc:creator>
    <dc:date>2013-11-19T07:10:03Z</dc:date>
    <item>
      <title>num() rounds differently to round() for half-step values</title>
      <link>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541457#M4240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've been doing some work on writing rounded numbers to file (for which I've used num(), and then providing a reconciliation to itemise the resulting rounding error (for which I've used round()).&amp;nbsp; But I've discovered that num() rounds differently to round(), which ruins my reconciliation!&amp;nbsp; Obviously, I already know how to workaround this problem to ensure my reconciliation works; but of course I'm interested in this from the bug perspective to see if you agree that this is a bonfide bug that I should report, and whether it's a batle worth fighting for the Community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This bug concerns values that are half-steps i.e. exactly half-way between two consecutive rounded values e.g. when rounding to 1 decimal place, how should 3.5 be rounded?&amp;nbsp; Round() is consistent in rounding such numbers towards zero i.e. positive half-step numbers get rounded down and negative half-step numbers get rounded up.&amp;nbsp; Sometimes it goes the other way; but I accept that this is likely due to the numbers have a tiny amount of machine fp error that sends the rounding the other direction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Num(), though, from the small amount of testing I've down, consistently rounds negative half-steps &lt;EM&gt;down&lt;/EM&gt;, while positive ones have no obvious pattern as to which ones round up and which ones round down. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See attached QVW for tabulation of these different behaviours.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your thoughts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Angus.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Jul 2025 14:48:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541457#M4240</guid>
      <dc:creator>gussfish</dc:creator>
      <dc:date>2025-07-23T14:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: num() rounds differently to round() for half-step values</title>
      <link>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541458#M4241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Angus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also discovered similar problems with round() on half-step values: &lt;A href="https://community.qlik.com/message/378484"&gt;Rounding Issues&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, round() doesn't work consistent either:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;round(2.05, 0.1) =&amp;gt; 2.0 should be 2.1&lt;/P&gt;&lt;P&gt;round(2.15, 0.1) =&amp;gt; 2.1 should be 2.2&lt;/P&gt;&lt;P&gt;round(2.25, 0.1) =&amp;gt; 2.3 ok&lt;/P&gt;&lt;P&gt;round(2.35, 0.1) =&amp;gt; 2.3 should be 2.4&lt;/P&gt;&lt;P&gt;round(2.45, 0.1) =&amp;gt; 2.4 should be 2.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To solve this (floating-point arithmetic issue) I used the round on an integer value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;round(2.15 * 10, 1) / 10&amp;nbsp; =&amp;gt; &lt;STRONG&gt;2.2 ok&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But, I think this should be fixed inside the round() function!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Ralf&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 06:51:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541458#M4241</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2013-11-19T06:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Re: num() rounds differently to round() for half-step values</title>
      <link>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541459#M4242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To illustrate I've added Integer Rounding to your app.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 07:02:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541459#M4242</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2013-11-19T07:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: num() rounds differently to round() for half-step values</title>
      <link>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541460#M4243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;However, results seems to be also version related. And now I get even different results than as I've posted the original post a few month ago..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Nov 2013 07:10:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Archived-Groups/num-rounds-differently-to-round-for-half-step-values/m-p/541460#M4243</guid>
      <dc:creator>rbecher</dc:creator>
      <dc:date>2013-11-19T07:10:03Z</dc:date>
    </item>
  </channel>
</rss>

