Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Decimal precision
Message
From
23/05/2012 09:12:48
 
 
To
23/05/2012 03:14:01
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01544101
Message ID:
01544135
Views:
29
>That depends on the context. If the context is currency, you will mostly only consider two decimals
>
>In your tax problem
>
>
>base for federal tax = 500.00
>round(500.00 * .05, 2) = 25.00 && federal tax
>
>base for  provincial tax = 500.00 + 25.00 = 525.00
>
>round( ( 500.00 + 25.00) * 9.5 / 100, 2) = 49.88 && provincial tax
>
>Total = 500.00 + 25.00 + 49.88 = 574.88
>
>
>So, if you want to reverse the process, you have to apply the steps backwards - one at a time - do not combine them - this is no algebra
>After each division you have to round to 2 decimals
>
>
>Total = 574.88
>(1) 
>Base for provincial tax = round( 574.88 / 1.095, 2) = 525.00
>
>provincial tax = 574.88 -  525.00 = 49.88
>
>(2) 
>base for federal tax = Base for provincial tax / 1.05
>base for federal tax = round( 525.00 / 1.05, 2)  = 500.00
>federal tax = 525.00 - 500.00 = 25.00
>
>
>
>iow, you need two decimals since the taxes were calculated with two decimals
>
>You apply the steps backwards
> - dividing and rounding to 2 decimals to obtain the base
> - subtracting to obtain the tax ( do not use a division here )

Thanks, this sums it all assuming you have the original amount. In the other thread, where I am looking for the formula, we do not have the original amount. We only have the total tax amount and we need to collect each tax from that total tax amount.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform