oracle double decimal problem

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
HCRoman
Posts: 55
Joined: Wed 12 Aug 2009 05:47

oracle double decimal problem

Post by HCRoman » Thu 15 Oct 2009 13:46

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 16 Oct 2009 13:18

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.

HCRoman
Posts: 55
Joined: Wed 12 Aug 2009 05:47

double trouble

Post by HCRoman » Fri 16 Oct 2009 14:28

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 20 Oct 2009 08:38

The problem is fixed in the upcoming Beta build of dotConnects.
We plan to release this build this or next week.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 02 Nov 2009 10:58

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 01 Dec 2009 11:34

We have added the rounding of double values in the upcoming release.

glittle
Posts: 12
Joined: Thu 14 Nov 2019 17:51

Re: oracle double decimal problem

Post by glittle » 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?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: oracle double decimal problem

Post by Shalex » Fri 09 Oct 2020 21:04

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.

Post Reply