将两个REAL值一起添加时的MySQL错误

时间:2015-11-21 01:27:18

标签: mysql stored-procedures

为什么运行此代码时,输​​出为0.21000000000000002而不是0.21?

BEGIN
    DECLARE S1 REAL;
    DECLARE S2 REAL;
    DECLARE Srainfall REAL;
    SET S1 = .04;
    SET S2 = .17;
    SET Srainfall = S1 + S2;
    Insert into Statistical_info(City_id, Total_Rain_fall)
    values(ID, Srainfall);
END

0 个答案:

没有答案