You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Maciej Bryński (Jira)" <ji...@apache.org> on 2021/04/09 13:45:00 UTC

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

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)