<?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 Floating point precision in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Floating-point-precision/m-p/306560#M707942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My QV application is reading figures from a QVD file that is populated with figures coming from a DB2 (iSeries) database.&lt;/P&gt;&lt;P&gt;The drivers used in QV are the native ones from IBM (System i access drivers for V6R1)&lt;/P&gt;&lt;P&gt;The database fields that are read are defined on the iSeries as 19P4 which means they can contain up to 4 decimals.&lt;/P&gt;&lt;P&gt;However, when transferring the data towards QV using SQL SELECT combined with sum and group by, I have figures that end up with more than 4 decimals.&lt;/P&gt;&lt;P&gt;As it consists of accounting figures, this is just impossible as all figures should only have max 2 decimals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to give you some background info so you understand my issue :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm loading accounting tables that reflect the details (so called general ledger lines)&lt;/P&gt;&lt;P&gt;I'm also loading accounting tables that reflect the balances (so called balances)&lt;/P&gt;&lt;P&gt;One of my QV apps checks the consistency between both and is calculating the difference by reversing the sign of one of both amounts and then performing a sum in a table where only records are withheld where the calculated difference &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;Now I end up with a whole lot of 'differences' that are shown as figures like -1.1234567124e-014 (which is actual very close to 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the explanation for this and is there any way to avoid this ?&lt;/P&gt;&lt;P&gt;I'm not in favour of rounding figures throughout the scripting process, that sounds like a bad idea to me.&lt;/P&gt;&lt;P&gt;I double checked the figures in the database and they can simply not have more than 4 decimals and no divisions or multiplication is being performed through the LOAD process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the script in a notepad file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Nov 2011 09:06:26 GMT</pubDate>
    <dc:creator />
    <dc:date>2011-11-09T09:06:26Z</dc:date>
    <item>
      <title>Floating point precision</title>
      <link>https://community.qlik.com/t5/QlikView/Floating-point-precision/m-p/306560#M707942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My QV application is reading figures from a QVD file that is populated with figures coming from a DB2 (iSeries) database.&lt;/P&gt;&lt;P&gt;The drivers used in QV are the native ones from IBM (System i access drivers for V6R1)&lt;/P&gt;&lt;P&gt;The database fields that are read are defined on the iSeries as 19P4 which means they can contain up to 4 decimals.&lt;/P&gt;&lt;P&gt;However, when transferring the data towards QV using SQL SELECT combined with sum and group by, I have figures that end up with more than 4 decimals.&lt;/P&gt;&lt;P&gt;As it consists of accounting figures, this is just impossible as all figures should only have max 2 decimals.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to give you some background info so you understand my issue :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm loading accounting tables that reflect the details (so called general ledger lines)&lt;/P&gt;&lt;P&gt;I'm also loading accounting tables that reflect the balances (so called balances)&lt;/P&gt;&lt;P&gt;One of my QV apps checks the consistency between both and is calculating the difference by reversing the sign of one of both amounts and then performing a sum in a table where only records are withheld where the calculated difference &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;Now I end up with a whole lot of 'differences' that are shown as figures like -1.1234567124e-014 (which is actual very close to 0)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the explanation for this and is there any way to avoid this ?&lt;/P&gt;&lt;P&gt;I'm not in favour of rounding figures throughout the scripting process, that sounds like a bad idea to me.&lt;/P&gt;&lt;P&gt;I double checked the figures in the database and they can simply not have more than 4 decimals and no divisions or multiplication is being performed through the LOAD process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have attached the script in a notepad file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2011 09:06:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Floating-point-precision/m-p/306560#M707942</guid>
      <dc:creator />
      <dc:date>2011-11-09T09:06:26Z</dc:date>
    </item>
  </channel>
</rss>

