0

I am creating a simple MySQL function for addition, the function works well for numbers with up to 10 decimal places, but when I pass A as 17.565714285714 and B as 22.8 I got 40.365714285714006 the function append 006 to the result, what could be a reason and how can I solve it. Mysql version is 8.0.18

DELIMITER $$
CREATE DEFINER=`root`@`localhost` 
FUNCTION `addition`(`A` DOUBLE, `B` DOUBLE) 
RETURNS DOUBLE
NO SQL
BEGIN
 RETURN A + B;
END$$
DELIMITER ;

enter image description here

imposterSyndrome
  • 896
  • 1
  • 7
  • 18
SteveTz
  • 172
  • 2
  • 8

0 Answers0