Redian新闻
>
Why the number is not exact in C++
avatar
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
avatar
w*n
2
Please. Even it's a supid question, pleas help me. Many thanks.
avatar
t*t
3
yes, of course.

y0,

【在 w****n 的大作中提到】
: 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

avatar
f*r
4
en, so called round off error in error analysis
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。