MySql multiplication between values of decimal type loses the precision

2

In my application I need precision for numeric values of 12 decimal places. I created the following test:

CREATE TABLE TESTE (
     VALOR1 DECIMAL(16,12),
     VALOR2 DECIMAL(16,12),
     VALOR3 DECIMAL(16,12) )

INSERT INTO TESTE (VALOR1, VALOR2)
VALUES ( 0.0001445312, 128)


UPDATE TESTE SET VALOR3 = VALOR1 * VALOR2


select valor3 from teste

valor3
0.0185

The correct value would be 0.0184999936, MySql rounds to 4 decimal places.

How to get the correct result of 0.0184999936 without rounding?

    
asked by anonymous 21.02.2017 / 00:51

0 answers