News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Round errors

Started by ugriecu, May 10, 2008, 15:34:41 PM

Previous topic - Next topic

ugriecu

try to add a new product with a gross price of 1.75 and apply a discount of 30%, the correct result is (1.225) 1.23 rounded but vm gives 1.22...anybody knows this problem/bug?


ugriecu

I also tried it in demo shop of virtuemart and showes 1.22.....what version do you use?


ugriecu

I'm sorry, but I've tried all version of vm and all have this bug, repeat:

-Insert ad product with a gross price of 1.75
-apply a discount of 30%
-(any tax if you want)
-click on save
-THE RESULT IS 1.22 AND NOT 1.23

ps: I also checked the flag to calculate the discount before tax and the bug persists

willowtree

I have the same error (1.22) on the following clean install:
Joomla! 1.5.3 Production/Stable [ Vahi *eCommerce Edition* ] 22-April-2008 22:00 GMT

VM 1.1
Please add your VM and Joomla Version to your signature to make it easier to help you:

Most of my code posted in the forum is for VirtueMart 1.0  -  not for 1.1

ugriecu

strange error, but discontinuos try:

gross price: 1.85
discount: 30%
result: 1.30 RIGHT!!!!!!!!!!!!!!!!!!(1.295)?????????????????????????????????????????

ANYBODY EXPLAINS  TO ME THIS???!!!!!!

willowtree

Please add your VM and Joomla Version to your signature to make it easier to help you:

Most of my code posted in the forum is for VirtueMart 1.0  -  not for 1.1

ugriecu

#8
another strange thing:

tax: 10%
gross price: 1.65
discount: 30%
CLICK ON SAVE RETURN TO CHECK THE PRODUCT AND:
final price: (1.155) 1.16 BUT VM GIVES ME 1.15???!!!!

I SUPPOSE IN A REAL BIG BUG

jjk

#9
Not shure yet, but I think this problem is related to the variable jos_vm_product_price and its setting in the mysql table.
It is set to the total number of 12 digits (the precision) and the number of 5 digits after the decimal point (the scale).

(Don't know where the rounding to two digits takes place - in MySQL or VM?)

One example from my installation:

If I type a product price (Gross) of 198.00 into the product information form, VM displays 166.38655 (VAT set to 19 percent) for the product price (Net). The last digit (5) is rounded - the numbers behind it are truncated. When I save this price, VM obviously recalculates the Gross price and changes my 198.00 to 197,99999 in the product information form, which is the result of taking the Net product price including its five digits after the decimal point x 1.19.

The 197,9999 has annoyed me for quite a while already although I didn't complain about it yet. Would be nice if I could see 198.00 in the administration product information form some time in the future. ;D

MySQL changed the handling of Decimal Data Types in MySQL 5.03. Maybe this is causing the output described in the first post of this thread.

Joerg
Joomla 1.5.3, VM 1.1
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations