Page 1 of 1

oracle double decimal problem

Posted: Thu 15 Oct 2009 13:46
by HCRoman
Hi devart team,

we have a serious problem with numeric columns, returning wrong values from the database!

The column is defined as NUMBER(13,2) the mapping maps this column to double.
The value in the database is 7.39 and after reading via Entity-Framework we get an double value of
7.390000006 !!!!

If we change the ssdl and the csdl to decimal 13,2 we get the correct value
back 7.39 as decimal

(This seems to be a known bug from former database wrappers....)

First Question:
As you anounced precision and scale are now supported,
for database reverse engeneering, but this does not work by default for
all numerics with precision/scale combinations. Only for unspecified columns or colums with specifications that exceeds double precision the decimal is correctly imported as for example decimal 25,20.

(up to now double does not support the usage of precision/scale notation)

What is to be done to get all numeric values mapped with correct precision/scale as double or how can we avoid the wrong conversion of the obove mentioned error.

Is it possible to have a check box to force the reverse engeneering to use decimals instead of doubles???

Tnx for your help

Roman

Posted: Fri 16 Oct 2009 13:18
by AndreyR
This is a known issue.
We are investigating the benefits and shortcomings of possible solutions.
I will let you know about the results of our investigation.

double trouble

Posted: Fri 16 Oct 2009 14:28
by HCRoman
ok, this should be known before I try to use doubles!!!
Please inform us when the problem is fixed.

It would be nice if you extend the EntityDeveloper to force decimals on demand?

Tnx

Roman

Posted: Tue 20 Oct 2009 08:38
by AndreyR
The problem is fixed in the upcoming Beta build of dotConnects.
We plan to release this build this or next week.

Posted: Mon 02 Nov 2009 10:58
by AndreyR
Sorry, my post was referring to the problem of mapping number parameters to System.Double.
As for this problem, our investigation is in progress. We plan to add some double handling in one of the nearest builds.

Posted: Tue 01 Dec 2009 11:34
by AndreyR
We have added the rounding of double values in the upcoming release.

Re: oracle double decimal problem

Posted: Fri 09 Oct 2020 01:14
by glittle
I'm seeing this 11 years later, with version 9.13.1098 of dotConnect for Oracle.

On a table defined as NUMBER(12,2), a query in Oracle returns 43518.20 but in C# it is 43518.200000000004

Is there anything I can do?

Re: oracle double decimal problem

Posted: Fri 09 Oct 2020 21:04
by Shalex
glittle wrote: Fri 09 Oct 2020 01:14 I'm seeing this 11 years later, with version 9.13.1098 of dotConnect for Oracle.

On a table defined as NUMBER(12,2), a query in Oracle returns 43518.20 but in C# it is 43518.200000000004

Is there anything I can do?
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.