Wrong precision for BigDecimal < 0 (since #2051) #2112
Labels
Bug
A bug in the driver. A high priority item that one can expect to be addressed quickly.
Projects
Milestone
Driver version
12.2.0
SQL Server version
Microsoft SQL Server 2019 (RTM-GDR) (KB5021125) - 15.0.2101.7 (X64) Jan 23 2023 13:08:05 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise LTSC 2019 10.0 (Build 17763: ) (Hypervisor)
Client Operating System
Windows 10
JAVA/JVM version
1.8.0
Table schema
n/a
Problem description
The precision for BigDecimals < 0 is always 1 higher than it should.
For example a BigDecimal less than 0 with a precision of 38:
0.98432319763138435186412316842316874322
results: decimal(39,38)
This caused an error:
But the value fits to a decimal(38,38). Tested with the following sql:
On the other side a BigDecimal biger than 1 and a precision of 38:
1.9843231976313843518641231684231687432
results: decimal(38,37)
So the problem only occurs for BigDecimals < 0.
#####################
Quick test class:
Output:
The text was updated successfully, but these errors were encountered: