Bug #89015 round behavior is inconsistent when used in select queries
Submitted: 21 Dec 2017 13:25 Modified: 22 Dec 2017 10:52
Reporter: Sunil Mali Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: DML Severity:S1 (Critical)
Version:5.7.17 OS:Windows (windows 10)
Assigned to: CPU Architecture:Any
Tags: inconsistent behavior of round function

[21 Dec 2017 13:25] Sunil Mali
round function gives inconsistent output. 
Lets say I have a no 23.5 

if I do round(23.5,0) from dual it will give result 24.

but if i have the same no in my tables then for few rows it rounds of to 24 for some rows and for some rows it rounds of to 23. Which is creating problems with our calculations.

How to repeat:
create a table with 'no' column as float

insert some decimal numbers into that column with few rows having data like 23.5, 54.4, 58.7, 24.5, 98.5, 100

then try select round(no,0) from mytable;
[22 Dec 2017 10:52] MySQL Verification Team
Thank you for the bug report. Expected behavior when using float columns:

How to repeat:
create a table with 'no' column as float

Please read: