[jira] [Created] (FLINK-22182) Incorrect round when dividing two decimals

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (FLINK-22182) Incorrect round when dividing two decimals

Shang Yuanchun (Jira)
Maciej Bryński created FLINK-22182:
--------------------------------------

             Summary: Incorrect round when dividing two decimals
                 Key: FLINK-22182
                 URL: https://issues.apache.org/jira/browse/FLINK-22182
             Project: Flink
          Issue Type: Bug
          Components: Table SQL / Runtime
    Affects Versions: 1.12.2
            Reporter: Maciej Bryński


Hi,

I have following problem:
This query:
{code:java}
select ((CAST(28604 as decimal(38,4)))/(cast(451 as decimal(38,4))) - 1121)/10 ;
{code}
Gives following answer:
{code:java}
-105.757650000000000000
{code}
Correct answer should be:
{code:java}
-105,75764966740576496674057649667
{code}
Why the result is rounded to 5th decimal place ?

Saving both values back to Decimal(38,4) column will give different results: -105.7577 vs -105.7576 (where second one is correct)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)