0.06-0.01-0.05得到的结果是-5.20417e-18,并不是想象中的0.0
SKILL Language User Guide.pdf的第128页Floating_Point Issues中写了这个问题,原文如下:
Because IEEE floating-point numbers use what are essentially binary (base 2) fractions to represent real numbers, some functions that operate on floating-point numbers yield unexpected (and incorrect) results. There are some floating-point numbers that the computer cannot represent exactly as binary fractions. In these cases, the computer uses a binary (base 2) floating-point number to approximate your decimal (base 10) floating-point number. These approximations can lead to incorrect results for some functions that operate on floating-point numbers.