<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Error Rounding with Tax]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=6909</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=6909&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Error Rounding with Tax.]]></description>
		<lastBuildDate>Sat, 02 Sep 2017 16:41:21 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28553#p28553</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 02 Sep 2017 16:41:21 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28553#p28553</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28521#p28521</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (hakim)]]></author>
			<pubDate>Thu, 31 Aug 2017 02:55:41 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28521#p28521</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28507#p28507</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Tue, 29 Aug 2017 05:04:49 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28507#p28507</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28506#p28506</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (hakim)]]></author>
			<pubDate>Tue, 29 Aug 2017 04:42:17 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28506#p28506</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28467#p28467</link>
			<description><![CDATA[<p>thanks for the feedback, <br />we still try first to check this will rounding to expected values.</p><p>thanks</p>]]></description>
			<author><![CDATA[null@example.com (ichtus)]]></author>
			<pubDate>Wed, 23 Aug 2017 04:32:07 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28467#p28467</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28389#p28389</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 14 Aug 2017 08:22:52 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28389#p28389</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28386#p28386</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (ichtus)]]></author>
			<pubDate>Mon, 14 Aug 2017 07:30:58 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28386#p28386</guid>
		</item>
		<item>
			<title><![CDATA[Re: Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28339#p28339</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 07 Aug 2017 13:59:01 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28339#p28339</guid>
		</item>
		<item>
			<title><![CDATA[Error Rounding with Tax]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=28335#p28335</link>
			<description><![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>]]></description>
			<author><![CDATA[null@example.com (hakim)]]></author>
			<pubDate>Mon, 07 Aug 2017 04:36:51 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=28335#p28335</guid>
		</item>
	</channel>
</rss>
