[ https://issues.apache.org/jira/browse/FLINK-22182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17340112#comment-17340112 ]
Shuo Cheng commented on FLINK-22182: ------------------------------------ Actually, the precision of the result may be larger than 38, usually the scale is sacrificed for more space for integral parts. > Incorrect round when dividing 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 > Priority: Major > > 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)