- - Urgent need for a solution - -
I'm using Oracle DBConnect version 8.4.274.6 with entity framework 6 against an Oracle 11g database. I have column in a table defined as number (12,2). If that data in the column a value to the right of the decimal point of 33 (e.g. 200000.33) and the whole number portion is a number >=131,099 and < 262150, then the value in the column's property on the domain object is padded with additional numbers e.g. 131099.33000000002.
If the number has a decimal value other than .33, this padding does not happen. e.g. 131099.34, does not have this issue. I have been able to reproduce this consistently. To reproduce, use a table with a column defined as number (12,2), us an app with the versions listed above. Select a row into a domain object for the table and break point on the column. You will see the padding if the numbers are in the range. Use 111.33 (for example) no problem. Interestingly, a ToString() on the property only returns 2 decimal places. But copying the property with no transformation to another double variable keeps on the decimal points. I have test this with updating the data in the database outside the app with SQL Navigator. Inside the app, etc.
Need a fix as soon as possible (or a viable workaround).
Double padded with extra decimal places
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Double padded with extra decimal places
We have answered you via e-mail.
Re: Double padded with extra decimal places
I have the same problem today. What was the solution?
I can run a query in Oracle and get 43518.20 but in C# it is 43518.200000000004
I can run a query in Oracle and get 43518.20 but in C# it is 43518.200000000004
Re: Double padded with extra decimal places
Your connection mode is OCI (via Oracle Client), isn't it? Direct Mode should work correctly.
The difference in the results between OCI and Direct modes is caused by the data type used for reading data from the server:
* OCI reads double (8 bytes)
* Direct reads number (22 bytes) and converts the number to double at the client side.
As a workaround, either change connection mapping from double to decimal with the "Number Mappings = (Number, 1, 15, System.Decimal);" connection string parameter (for the OCI mode) or switch to the Direct mode.