作为参数传递给函数时,double值正在更改

时间:2018-11-02 22:01:20

标签: c++

我试图将声明为const的double传递给函数。

const double temp = 0.0007;
compute(temp); // calling compute function with double as argument

计算函数声明为compute(const double&)

    When i test it the double value gets converted to **0.00069999999999999999** 

compute (this=0x8173870, max_warpage_limit=@0xdaf450: 0.00069999999999999999,  at test.cpp:283

精度对我来说至关重要,因为我在计算中使用了该值,并且这种偏差是不可接受的。 请这里的专家可以分享他们对正在发生的事情的看法吗? 期待您的意见

0 个答案:

没有答案