<?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: Issue convert string to BigDecimal and  dividing by 100? in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Issue-convert-string-to-BigDecimal-and-dividing-by-100/m-p/2296768#M69397</link>
    <description>&lt;P&gt;&lt;SPAN&gt;The BigDecimal(double) constructor have some problems, is preferrable that you uses BigDecimal(String) or BigDecimal.valueOf(double).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BigDecimal(double) documentation explain about this behavior:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
 &lt;OL&gt;
  &lt;LI&gt;The results of this constructor can be somewhat unpredictable. One might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to 0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). Thus, the value that is being passed in to the constructor is not exactly equal to 0.1, appearances notwithstanding.&lt;/LI&gt;
  &lt;LI&gt;The String constructor, on the other hand, is perfectly predictable: writing new BigDecimal("0.1") creates a BigDecimal which is exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the String constructor be used in preference to this one.&lt;/LI&gt;
  &lt;LI&gt;When a double must be used as a source for a BigDecimal, note that this constructor provides an exact conversion; it does not give the same result as converting the double to a String using the Double.toString(double) method and then using the BigDecimal(String) constructor. To get that result, use the static valueOf(double) method.&lt;/LI&gt;
 &lt;/OL&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Wed, 08 Aug 2018 11:12:45 GMT</pubDate>
    <dc:creator>iamabhishek</dc:creator>
    <dc:date>2018-08-08T11:12:45Z</dc:date>
    <item>
      <title>Issue convert string to BigDecimal and  dividing by 100?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-convert-string-to-BigDecimal-and-dividing-by-100/m-p/2296767#M69396</link>
      <description>&lt;P&gt;In tmap,&lt;/P&gt;
&lt;P&gt;my source column called ProdPct&amp;nbsp;is string type and lookup table column is called ProdPct is BigDecimal.&lt;/P&gt;
&lt;P&gt;Trying to convert the source to match to ProdPct and it is not matching.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;used this expression to convert string to BigDecimal and it is not working.&lt;/P&gt;
&lt;P&gt;new BigDecimal(Numeric.convertImpliedDecimalFormat("9V99",Source.Prodpct))&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Source table:&lt;/P&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;P&gt;10&lt;/P&gt;
&lt;P&gt;20&lt;/P&gt;
&lt;P&gt;30&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Lookup table:&lt;/P&gt;
&lt;P&gt;0.00&lt;/P&gt;
&lt;P&gt;0.10&lt;/P&gt;
&lt;P&gt;0.20&lt;/P&gt;
&lt;P&gt;0.30&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;used tLog and shows as follow:&lt;/P&gt;
&lt;P&gt;0&lt;/P&gt;
&lt;P&gt;0.100000001490116119384765625&lt;/P&gt;
&lt;P&gt;0.20000000298023223876953125&amp;nbsp;&lt;/P&gt;
&lt;P&gt;0.300000011920928955078125&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is the syntax to see the results as follow?&lt;/P&gt;
&lt;P&gt;0.00&lt;/P&gt;
&lt;P&gt;0.10&lt;/P&gt;
&lt;P&gt;0.20&lt;/P&gt;
&lt;P&gt;0.30&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Aug 2018 21:37:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-convert-string-to-BigDecimal-and-dividing-by-100/m-p/2296767#M69396</guid>
      <dc:creator>rp2018</dc:creator>
      <dc:date>2018-08-07T21:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Issue convert string to BigDecimal and  dividing by 100?</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-convert-string-to-BigDecimal-and-dividing-by-100/m-p/2296768#M69397</link>
      <description>&lt;P&gt;&lt;SPAN&gt;The BigDecimal(double) constructor have some problems, is preferrable that you uses BigDecimal(String) or BigDecimal.valueOf(double).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The BigDecimal(double) documentation explain about this behavior:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
 &lt;OL&gt;
  &lt;LI&gt;The results of this constructor can be somewhat unpredictable. One might assume that writing new BigDecimal(0.1) in Java creates a BigDecimal which is exactly equal to 0.1 (an unscaled value of 1, with a scale of 1), but it is actually equal to 0.1000000000000000055511151231257827021181583404541015625. This is because 0.1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). Thus, the value that is being passed in to the constructor is not exactly equal to 0.1, appearances notwithstanding.&lt;/LI&gt;
  &lt;LI&gt;The String constructor, on the other hand, is perfectly predictable: writing new BigDecimal("0.1") creates a BigDecimal which is exactly equal to 0.1, as one would expect. Therefore, it is generally recommended that the String constructor be used in preference to this one.&lt;/LI&gt;
  &lt;LI&gt;When a double must be used as a source for a BigDecimal, note that this constructor provides an exact conversion; it does not give the same result as converting the double to a String using the Double.toString(double) method and then using the BigDecimal(String) constructor. To get that result, use the static valueOf(double) method.&lt;/LI&gt;
 &lt;/OL&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 08 Aug 2018 11:12:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-convert-string-to-BigDecimal-and-dividing-by-100/m-p/2296768#M69397</guid>
      <dc:creator>iamabhishek</dc:creator>
      <dc:date>2018-08-08T11:12:45Z</dc:date>
    </item>
  </channel>
</rss>

