MySQL Forums
Forum List  »  General

ROUND discrepancy
Posted by: Chris Thorley
Date: January 29, 2020 04:30AM

Why don’t these two mysql operations give me the same answer.


##### Operation 1 - SQL #####

SELECT ROUND(2.56789, 2) FROM DUAL;

Gives Answer = 2.57


##### Operation 2 - Function #####

BEGIN
DECLARE r FLOAT;
SET r = ROUND(2.56789, 2);
RETURN r;
END

Gives Answer = 2.5699999332428

Just wanted your take on this.

Thanks
Chris

Options: ReplyQuote


Subject
Written By
Posted
ROUND discrepancy
January 29, 2020 04:30AM
January 29, 2020 09:49AM
January 30, 2020 08:13AM
January 30, 2020 09:28AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.