Why the number is not exact in C++# Programming - 葵花宝典
w*n
1 楼
This is the declaration of my function, a constructor actually:
typedef long double number;
Ode::Ode(const number xi, const number xt, const number h, const number y0,
Function& ff) ;
Then I used this function:
Ode tryode(0,10,0.1,0,f);
But when I used gdb to see what happens there, I see h=0.
1000000000000000055511151231257827, not exactly 0.1. Is that due to the
accuracy of the computer?
Thanks
typedef long double number;
Ode::Ode(const number xi, const number xt, const number h, const number y0,
Function& ff) ;
Then I used this function:
Ode tryode(0,10,0.1,0,f);
But when I used gdb to see what happens there, I see h=0.
1000000000000000055511151231257827, not exactly 0.1. Is that due to the
accuracy of the computer?
Thanks