当我使用以下代码时:
seq(-1.2, 0.1, 0.1)
我得到以下结果,这几乎是正确的,但略有错误:
[1] -1.1999999999999999555911 -1.0999999999999998667732
[3] -1.0000000000000000000000 -0.8999999999999999111822
[5] -0.7999999999999999333866 -0.6999999999999999555911
[7] -0.5999999999999998667732 -0.4999999999999998889777
[9] -0.3999999999999999111822 -0.2999999999999999333866
[11] -0.1999999999999999555911 -0.0999999999999998667732
[13] 0.0000000000000002220446 0.1000000000000000055511
这是怎么回事?
通过非常类似的查询,我确实获得了预期的结果:
> seq(-1.1, 0.1, 0.1)
[1] -1.1 -1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1