<?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 Please explain the logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078036#M1356502</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The output of the following program is 1.&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;DATA: pack TYPE p DECIMALS 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pack = 1 / 3 * 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE pack.&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please explain me the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lakshmanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Aug 2009 12:36:22 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-28T12:36:22Z</dc:date>
    <item>
      <title>Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078036#M1356502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The output of the following program is 1.&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;DATA: pack TYPE p DECIMALS 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pack = 1 / 3 * 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE pack.&lt;/P&gt;&lt;P&gt;***************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please explain me the logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Lakshmanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2009 12:36:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078036#M1356502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-28T12:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078037#M1356503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Congratulations, you have made a great arithmetical discovery !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2009 16:48:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078037#M1356503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-28T16:48:01Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078038#M1356504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;SInce you have defined decimals 0, the number is rounded to the nearest number.&lt;/P&gt;&lt;P&gt;you might have expected to display .9999999, but it rounds the decimals to display 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the same research with different data types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subramanian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Aug 2009 16:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078038#M1356504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-28T16:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078039#M1356505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Hi all,&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  The output of the following program is 1.&lt;/P&gt;&lt;P&gt;&amp;gt; ***************************************************&lt;/P&gt;&lt;P&gt;&amp;gt; DATA: pack TYPE p DECIMALS 0.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; pack = 1 / 3 * 3.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; WRITE pack.&lt;/P&gt;&lt;P&gt;&amp;gt; ***************************************************&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Please explain me the logic.&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Regards,&lt;/P&gt;&lt;P&gt;&amp;gt; Lakshmanan&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you not do well in your simple arithmetic exams?  Anyway, the answer in base 3.5 is Pi, funnily enough.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 18:16:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078039#M1356505</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-08-31T18:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078040#M1356506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Olivier and Matt, I had the same reaction, but if I understand well the question, it's not so simple to answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As explained in [abap help - calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm], SAP looks at the type of all variables concerned which are P (pack), I (1), I (3), I (3). This means that the calculation type will be P (the type which can handle the highest value). SAP uses a very large temporary P with maximum of digits and decimals. Thus, the result of 1 / 3 * 3 will be 0.999999999999. Then it copies the value to "pack" variable, and as this last has no decimals, it rounds it to the nearest value, which is 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lakhshaman, please be careful with your question, you should have expected such reactions, you should have indicated what is exactly the problem you have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that was fun &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2009 19:14:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078040#M1356506</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-08-31T19:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078041#M1356507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But Sandra - he says the output of his program is 1,  Not 0,999999999.  So, according to the question, he wants to understand why 1 divided by 3 multiplied by 3 is 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I want to know is, why -1 raised to the power of (4/6) has more answers than -1 raised to the power of (2/3).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 05:40:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078041#M1356507</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-09-01T05:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078042#M1356508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Thanks for all of your time and responses.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  As Rossi said, I should have made my question clear. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Now, the following statement is found in the ABAP keyword documentation:&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;pre&amp;gt;Within one set of parentheses, calculations with operators of higher priority are performed before calculations with operators of a lower priority. For consecutive operators with the same priority, the calculation is performed in the order specified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Operator                       Calculation                                                                     Priority                                                Order &lt;/P&gt;&lt;P&gt;       +             Addition of operands                                                                          1                                           from left to right &lt;/P&gt;&lt;P&gt;       -         Subtraction of the right from the left operand                                         1                                                   left to right &lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         Multiplication of operands                                                                       2                                           from left to right &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      /           Division of the left by the right operand                                                  2                                           from left to right &lt;/P&gt;&lt;P&gt;    DIV           Integer portion of the division of the left by the right operand             2                                            from left to right &lt;/P&gt;&lt;P&gt;   MOD         Integer remainder of the division of the left by the right operand         2                                             from left to right &lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;             Exponentiation of the left with the right operand                               3                                             from right to left &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&amp;lt;/pre&amp;gt;&lt;/P&gt;&lt;P&gt;Now, here is the program and the result is 1.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;pre&amp;gt;DATA: pack TYPE p DECIMALS 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pack = 1 / 3 * 3. &amp;lt;/pre&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the calculation type of the expression is p(pack).&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; =&amp;gt; According to the table above, / and * have the same priority 2, for consecutive operators with the same priority, the calculation is performed in the order specified in the table. In the table above * comes before  / .&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the calculation should be performed with multiplication first and division next. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;So 1 /  3 * 3 =&amp;gt; 1 / 9 which results to 0.111111..... and not 0.99999.....&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, in 0.11111.... the fractional part will be  rounded to 0.1&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Earlier I wondered how 0.1 can be rounded to 1, as 0.1 &amp;lt;  0.5.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now with the responses of friends like  Subramanian, Rossi and others ,&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt; I have understood that since the result variable pack has 0 decimal places, 0.1 is assigned as 1 to 'pack'.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know whether my understanding is correct.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;Lakshmanan&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;Edited by: Matt on Sep 1, 2009 1:58 PM - cleanup formating&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 06:45:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078042#M1356508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-01T06:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078043#M1356509</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Here the calculation type of the expression is p(pack). &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;YES&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt;  =&amp;gt; According to the table above, / and * have the same priority 2, for consecutive operators with the same priority, the calculation is performed in the order specified in the table. In the table above * comes before  / . &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;when you have the same priority, you must not consider that one operator is "above" or "below" the other, but use the "order" column, here it is "left to right"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; So the calculation should be performed with multiplication first and division next. &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;NO, when it's the same priority, you must evaluate as indicated in "order" column, here from "left to right", so sap calculates first 1 / 3, 0.3333333, then it multiplies by 3 which gives 0.99999... Then, when SAP transfers this value to "pack", it must round it because this last has 0 decimals, which gives 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; So 1 /  3 * 3 =&amp;gt; 1 / 9 which results to 0.111111..... and not 0.99999..... &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;bad initial assumption&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Now, in 0.11111.... the fractional part will be  rounded to 0.1 &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;bad initial assumption&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; Earlier I wondered how 0.1 can be rounded to 1, as 0.1 &amp;lt;  0.5. &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;it can't, SAP always rounds \[x....x4999...\] to x, and \[x5...x9999...\] to x+1, it's just a bad initial assumption&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; Now with the responses of friends like  Subramanian, Rossi and others ,&lt;/P&gt;&lt;P&gt;&amp;gt;  I have understood that since the result variable pack has 0 decimal places, 0.1 is assigned as 1 to 'pack'. &lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;bad initial assumption. Just a remark here, maybe you confuse with statement PACK (or program not using "fixed point arithmetic") which would sometimes transform 0.1 to 1. But 99.9999% of the time, you will not encounter this situation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it's clear now &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 08:26:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078043#M1356509</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-01T08:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078044#M1356510</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think Lakshmanan doesnot remember basic arithmetic rule BODMAS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont think SAP overrides (or rather dares to override) the BODMAS rule.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lakshmanan assumes that &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1 / 3 * 3 = 1 / 9 = 0.11111....&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But apply BODMAS &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;1 / 3 * 3 = 0.33333.... * 3 = 0.99999...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree with Matt that this is question is not about SAP rounding off logic, rather a lack of basic arithmetic principle.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 08:50:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078044#M1356510</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-09-01T08:50:24Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078045#M1356511</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;2 fun exercises:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data int type i.
int = 1 / 3 * 3.
write int.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;what do you expect? what is the result?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's zero!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now with that:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data int type i.
int = 1 / 3 * '3'.
write int.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's one!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fun &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not always so obvious. I think Lakshmanan expected my answer &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;okay, with packed fields, it's really more obvious, but not always.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 10:04:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078045#M1356511</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2009-09-01T10:04:44Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078046#M1356512</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sandra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OMG !!! C'mon SAP can't do this &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, how did you come about this? I can never imagine this in my wildest dreams &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 10:08:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078046#M1356512</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-09-01T10:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078047#M1356513</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now switch off the fixed point arithmetic flag... &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 12:02:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078047#M1356513</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2009-09-01T12:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078048#M1356514</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;  =&amp;gt; According to the table above, / and * have the same priority 2, for consecutive operators with the same priority, the calculation is performed in the order specified in the table. In the table above * comes before  / .&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;P&gt;&amp;gt; So the calculation should be performed with multiplication first and division next. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;gt; So 1 /  3 * 3 =&amp;gt; 1 / 9 which results to 0.111111..... and not 0.99999.....&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the order column next to * and / . Its from left to right. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thus in 1 /  3 * 3 , consider it from left to right. Thus / will be performmed first and not the *. You are considering right to left which is wrong. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you are clear now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vikranth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Sep 2009 12:05:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078048#M1356514</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-01T12:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Please explain the logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078049#M1356515</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now lets assume that we don't have absolute figures but variables,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So&lt;/P&gt;&lt;P&gt;" Assume that all the values are of type XKWERT&lt;/P&gt;&lt;P&gt; A = 1&lt;/P&gt;&lt;P&gt;B = 3&lt;/P&gt;&lt;P&gt;C = 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, Z =  A / B * C&lt;/P&gt;&lt;P&gt;Z = 1/9 = 0.111111111&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How does this happen? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now as strange behaviour has been noticed, in one of our clients Z = 1 and in other client z = 0.111111111&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know the solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dantham Conplowedson&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jun 2011 18:05:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/please-explain-the-logic/m-p/6078049#M1356515</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-14T18:05:33Z</dc:date>
    </item>
  </channel>
</rss>

