0

I have 2 tables, both having a field of type float(12,4).

lets say table1.field1 float(12,4) and table2.field1 float(12,4)

as you see the fields are declared the same

the issue is when updating these fields. if I update these fields with the same value, they will store different values.

insert into table1 (field1) value (101.4904); update table2 set field1=field1 + 101.4904

after these sql statements the fields will have a difference of 0.0018

this is tested on my local computer so there is no other updates made to the database.

any clue what is causing this difference?

Loginname
  • 11
  • 3

1 Answers1

1

float is a inaccurate data type by definition. If you need exact precision then use decimal(15,6) for instance

juergen d
  • 201,996
  • 37
  • 293
  • 362