<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[FrontAccounting forum — Error Rounding with Tax]]></title>
	<link rel="self" href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6909&amp;type=atom" />
	<updated>2017-09-02T16:41:21Z</updated>
	<generator>PunBB</generator>
	<id>https://frontaccounting.com/punbb/viewtopic.php?id=6909</id>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28553#p28553" />
			<content type="html"><![CDATA[<p>Try smaller numbers first and see when the error occurs. <a href="http://www.serverphorums.com/read.php?7,270282,270282#msg-270282">You should not exhaust the floating point precision</a> of your variable.</p><p>This is a <a href="https://www.leaseweb.com/labs/2013/06/the-php-floating-point-precision-is-wrong-by-default/">PHP issue</a>:<br /></p><div class="codebox"><pre><code>$a = 31975454.54545400;
$b = 3197545.45454540;

echo $a+$b;

// Outputs: 35172999.999999</code></pre></div><p>What is the value of <strong>precision</strong> in your <strong>php.ini</strong> file?<br />Increase it and see what happens.</p><p>Increasing it from 14 to 17 in PHP 5.3.3 on 32 bit XAMPP:<br /></p><div class="codebox"><pre><code>$a = 31975454.54545400;
$b = 3197545.45454540;

echo $a+$b;

// Outputs 35172999.999999397</code></pre></div><p>This might do the job.</p><p>In the code, it can be dynamically set as well:<br /></p><div class="codebox"><pre><code>ini_set(&#039;precision&#039;, 17);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-09-02T16:41:21Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28553#p28553</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28521#p28521" />
			<content type="html"><![CDATA[<p>I&#039;ve tried the way you suggest, but it still doesn&#039;t work.<br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtSEFNMGFkbUtEUkU">Display Setup.png</a></p><p>Our Home Currency is IDR, and we only make transactions with IDR currency only. so we do not need any other currency exchange rates<br />I have explained in first post, if the quantity order 1 unit then Amount Total is correct, but&nbsp; for quantity above 2 units make Amount Total wrong.</p>]]></content>
			<author>
				<name><![CDATA[hakim]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20165</uri>
			</author>
			<updated>2017-08-31T02:55:41Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28521#p28521</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28507#p28507" />
			<content type="html"><![CDATA[<p>Try to see if the latest debian based php version solves your issue.<br />Check out MariaDB as well.</p><p>The easiest way is for you to use the companys&#039; default base home currency as IDR and work from there using standard 8 decimal places for exchange rates and 2 decimals for prices/amounts.</p><p>You can play around with the constant FLOAT_COMP_DELTA defined in <strong>current_user.inc</strong> which is by default set at 0.004. Checkout the function <strong>round2()</strong> and <strong>number_format2()</strong> on the use of the value +/- .0000000001 in the same file.</p><p>Also see if you can use a larger unit for items to get meaningful rates per unit.</p><p>Try 8 decimal places for Exchange Rates and 0 or 2 decimal places for Prices/Amounts.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-29T05:04:49Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28507#p28507</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28506#p28506" />
			<content type="html"><![CDATA[<p>I have change the decimal places.<br />The results below:<br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtbE0xZk5KUkIzNVE">4 decimal with 1 qty.png</a><br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtS2JLQTZXeFY0bG8">4 decimal with 2 qty.png</a><br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtaFRZbE1oRERtcFU">8 decimal with 2 qty.png</a><br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtclBEMzdYWF9sdEU">8 decimal with 2 qty.png</a></p><p>Any other solution?</p>]]></content>
			<author>
				<name><![CDATA[hakim]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20165</uri>
			</author>
			<updated>2017-08-29T04:42:17Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28506#p28506</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28467#p28467" />
			<content type="html"><![CDATA[<p>thanks for the feedback, <br />we still try first to check this will rounding to expected values.</p><p>thanks</p>]]></content>
			<author>
				<name><![CDATA[ichtus]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=12975</uri>
			</author>
			<updated>2017-08-23T04:32:07Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28467#p28467</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28389#p28389" />
			<content type="html"><![CDATA[<p>Increase the number of decimal places for Exchange Rate to 8 from the default 4 in <strong>Setup -&gt; Display Setup</strong> (Preferences).</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-14T08:22:52Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28389#p28389</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28386#p28386" />
			<content type="html"><![CDATA[<p>Hi, </p><p>sorry for late reply, current vps server is using:<br />httpd-2.4.6-45.el7.centos.4.x86_64<br />mariadb-5.5.52-1.el7.x86_64<br />on centos 7, this problem is that will very likely to happen, as vendor do include tax in their price, sometimes don&#039;t<br />so the calc will cause floating point decimal.</p><p>pls advice. already tested in the latest FA 2.4.2</p><p>thanks</p>]]></content>
			<author>
				<name><![CDATA[ichtus]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=12975</uri>
			</author>
			<updated>2017-08-14T07:30:58Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28386#p28386</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28339#p28339" />
			<content type="html"><![CDATA[<p>https://stackoverflow.com/questions/4921466/php-rounding-error</p><p>Try on a 64 bit machine.<br />Provide details of PHP version number and Apache/mySQL/OS versions.</p>]]></content>
			<author>
				<name><![CDATA[apmuthu]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=364</uri>
			</author>
			<updated>2017-08-07T13:59:01Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28339#p28339</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Error Rounding with Tax]]></title>
			<link rel="alternate" href="https://frontaccounting.com/punbb/viewtopic.php?pid=28335#p28335" />
			<content type="html"><![CDATA[<p>I want to make a Purchase order with IDR currency<br />My purchase is use 10% tax with unit price of <span style="color: blue">IDR 17,586,500.00</span>, so I input should be <span style="color: blue">IDR 15,987,727.27</span>. (<span style="color: #FF0000">Attach PO1</span>).<br />But if the quantity change to 2 units, amount total result <span style="color: blue">IDR 35,172,999.99</span> (<span style="color: #FF0000">attach PO2</span>). It should be rounding to <span style="color: blue">IDR 35,173,000.00</span>.</p><p>Please help solution for this problem?</p><p>FrontAccounting ver 2.4.2</p><p><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtSmF2MGd2a2tndGM">PO1.png</a><br /><a href="https://drive.google.com/file/d/0BwcMoFjG8vYtOXlGZUdnUko5OUU">PO2.png</a></p>]]></content>
			<author>
				<name><![CDATA[hakim]]></name>
				<uri>https://frontaccounting.com/punbb/profile.php?id=20165</uri>
			</author>
			<updated>2017-08-07T04:36:51Z</updated>
			<id>https://frontaccounting.com/punbb/viewtopic.php?pid=28335#p28335</id>
		</entry>
</feed>
