Error when input low decimal values for SQL Server

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andy_bri
Posts: 19
Joined: Fri 02 Oct 2009 12:36

Error when input low decimal values for SQL Server

Post by andy_bri » Mon 21 Dec 2015 14:28

Important bug in version 6.2.9:
If one inputs value less than 0.1 it is multiplied by 10!
For example one inputs 0.04, but it is saved as 0.4.
This happens for SQL Server, but this bug does not appear for Firebird.

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Error when input low decimal values for SQL Server

Post by azyk » Wed 23 Dec 2015 15:26

Thank you for the information. We have reproduced this problem and are investigating it. We will notify you about the results as any are available.

cschwerdtfeger
Posts: 1
Joined: Thu 07 Jan 2016 12:46

Re: Error when input low decimal values for SQL Server

Post by cschwerdtfeger » Thu 07 Jan 2016 12:49

You can work around this bug when you cast the value to float.

Code: Select all

select (0.25 * 0.25)
yields 0.625, but

Code: Select all

select cast((0.25 * 0.25) as float)
yields 0.0625 which is correct.

It's not just multiplied by 10, the precision is ignored. 0.04 is interpreted as 0.4, but also 0.004 is interpreted as 0.4 and so on.
0.001 has a precision of 3, but is interpreted as 0.1, 0.01 has a precision of 2 but is also interpreted as 0.1.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Error when input low decimal values for SQL Server

Post by AlexP » Tue 12 Jan 2016 12:20

We have already fixed the problem. The fix will be included in the next version.

Post Reply