<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/discussions/f/general/17969/problems-mapping-decimal</link><description>Hi, 
 
 
 I&amp;#39;m having a problem with a decimal, 
 I have the value in a decimal type variable 
 
 9,820.65 
 
 But when I map it to a decimal type data that is in another cdt it saves this 
 
 9820.650000000001 
 
 Does anybody know what is it due to?</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70770?ContentTypeID=1</link><pubDate>Mon, 02 Dec 2019 13:06:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c3c74540-3df9-4b7e-9bba-91b3ee61042d</guid><dc:creator>sandrap845</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;is that it is the mapping in the node directly, take the process variable and in the node add it to the corresponding value.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70769?ContentTypeID=1</link><pubDate>Mon, 02 Dec 2019 13:05:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bf65b1f2-82b4-4e71-8cfd-f4ca70985e2c</guid><dc:creator>sandrap845</dc:creator><description>&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;Thank you very much David !!, very interesting information&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70752?ContentTypeID=1</link><pubDate>Fri, 29 Nov 2019 13:43:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:1e7b3090-e0ae-46e0-8d6f-3c06e1d694fb</guid><dc:creator>davel001150</dc:creator><description>&lt;p&gt;It&amp;#39;s because of floating point math.&lt;/p&gt;
&lt;p&gt;0.1 is only an approximation, because of the way Decimal is stored (as a Double precision floating point number in Java).&amp;nbsp; In binary, in that format, 1 / 10 is an infinitely repeating number, something like 0.00011001100110011. Nearly every number you see in decimal format is only an approximation of what can be represented in binary.&amp;nbsp; It&amp;#39;s like, how many halves, plus how many fourths, plus how many eighths, plus how many sixteenths, plus how many thirty-secondths, etc.&amp;nbsp; Unless it&amp;#39;s exactly a sum of negative powers of two, it can&amp;#39;t be represented fully accurately.&amp;nbsp; The further away from&amp;nbsp;1 or -1 you go, the wider the gaps between the numbers you can approximate.&amp;nbsp; All software everywhere has this problem.&amp;nbsp; Try it in Java:&amp;nbsp; 0.1 + 0.1 + 0.1 == 0.3 returns false.&lt;/p&gt;
&lt;p&gt;What can you do?&amp;nbsp;&amp;nbsp;Nothing, really.&amp;nbsp; You can try multiplying it by 100, 982,065, moving it to it&amp;#39;s own PV, then dividing that PV by 100 and putting the answer into the other CDT and see if you don&amp;#39;t get exactly the same behavior.&amp;nbsp; You could create a custom plugin to implement C#&amp;#39;s Decimal type, which stores the number as a 28 or 29 digit integer and then stores the location of the decimal point.&amp;nbsp; Or you could create a custom plugin to utilize the Java arbitrary precision mathematics library.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Or as the other posters have said, you can use the fixed function for display purposes.&amp;nbsp; So it&amp;#39;s off in the back-end; you just don&amp;#39;t let the end users know about it.&amp;nbsp; For the database, just store the digits you want using number(), for instance number(12,4) is up to 8 digits before the decimal and up to 4 digits after the decimal.&amp;nbsp; It will probably still be off deep within, but should refrain from telling you about it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70743?ContentTypeID=1</link><pubDate>Fri, 29 Nov 2019 12:43:52 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5d40dcd5-76b9-481c-80f3-54802bb4f982</guid><dc:creator>Harshit Bumb (Appyzie)</dc:creator><description>&lt;p&gt;Can you please paste the code snippet which you are using to cast/map the value to another CDT?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70732?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 10:35:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dc4dbb8c-1f26-4a4e-a45e-6008a60cf27d</guid><dc:creator>sandrap845</dc:creator><description>&lt;p&gt;Ok, I&amp;#39;ll try it, but do you know why this problem may be occurring?&lt;/p&gt;
&lt;p&gt;Greetings and thank you very much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70731?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 10:31:02 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dd8f57d1-6de4-4203-8ad0-8c3fd410e822</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Hi, i think it will work. before saving data, you just use fixed() function for that specific attribute and then save data in DB.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70727?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 09:48:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2aba4a7b-83fd-44f1-829d-970449c5b31f</guid><dc:creator>sandrap845</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;If I make a fixed, I would return a string but I have to keep that data in a decimal in a database.&lt;br /&gt;Wouldn&amp;#39;t this give problems?&lt;/p&gt;
&lt;p&gt;Greetings and thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PROBLEMS MAPPING DECIMAL</title><link>https://community.appian.com/thread/70726?ContentTypeID=1</link><pubDate>Thu, 28 Nov 2019 09:42:37 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:257303f5-1ceb-4f5d-9fdc-1816e662bc94</guid><dc:creator>Sandeep</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Try using fixed() function for it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>