A string value 58.83 is changed to 56,829999999999998 when inserted into a Oracle database FLOAT(126) column.
We are using:
- .NET Entity Framework 6,
- Devart dotConnect for Oracle Professional version 8.4.171.0 and
- Oracle 11g Enterprise Edition Release 11.2.0.3.0.
The string gets inserted within a CLOB field in Oracle then transformed to into a decimal in C# (the value still reads 58.83 after conversion to a decimal) before finally being inserted in a FLOAT field via Devart. The observed value stored in the column is 56,829999999999998.
When the value is read from the database it is still the wrong value.
What is causing the value to change from 58.83 to 56,829999999999998, Entity Framework, Devart or Oracle and how can we correct this behaviour?
UPDATE When testing from SQL Developer the numbers get inserted correctly.
The solution for the problem is to indeed, as comments suggested, change the data type to Number. I set the precision to * and scale (digits to the right of the decimal point) as 10.
Oracle docs state "This data type should never be used for precise values, such as currency."
This post decimal(s,p) or number(s,p)? helped explaining the difference between Number and Decimal data types when deciding an alternative to using a Float.