Problem with .net double type

Posts   
 
    
Steria
User
Posts: 64
Joined: 26-Nov-2008
# Posted on: 11-Feb-2009 09:47:55   

Hi,

We use an oracle database 10g, with the oracleDataAccess 2.102.2.20. For llblgen the version are : - SD.LLBLGen.Pro.DQE.Oracle10g.NET20.dll v2.6.8.819 - SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll v2.6.8.911 - SD.LLBLGen.Pro.TypeConverters.dll v2.6

In the database, we have a column with the data type NUMBER(12,2).

In this column, we have the value 83.85.

When i try to retrieve the value from the database, the value is retrieved as a double .net.

The problem is that the retrieved result is 83.849999999999994d.

But if i cast the value in decimal, i obtain the value 83.85.

Why the value retrieved by llblgen is different that the value in database? For me the correct result is 83.85, but is-it normal that i must cast the double value in decimal?

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Feb-2009 10:07:03   

NUMBER(12,2) should be mapped to Decimal. Does the .NET type in theLLBLGen Pro Designer appears to be Double?

Just to be in the safe side, would you please try downloading the latest version of LLBLgen Pro and re-fresh the catalog and then re-examine the .NET Type again.

You aren't using any TypeConverter that converts this field from decimal to double, are you?

Steria
User
Posts: 64
Joined: 26-Nov-2008
# Posted on: 11-Feb-2009 10:16:56   

Yes, the .Net type in LLBLGen Pro Designer is Double.

We don't use TypeConverter.

We left the default type.

The only thing that i've made is to try to cast the value from double to decimal in my source code to see if the value is correct if i cast in decimal.

But if i left the value retrieved by llblgen we have the strange value that i've written in my previous message.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Feb-2009 12:13:49   

A double isn't a precise type. ODP.NET converts it to double, that's not something we can change.

You can either crank up the precision to be 16 or higher, ODP.NET will convert this to decimal. Or you can just use a TypeConverter to cast the value to decimal as you did in your code.