a stupid problem
Moderator: Board moderators
a stupid problem
can anybody tell me why modf(pow(216,1/double(3)),&s)=1.0?
-
- System administrator & Problemsetter
- Posts: 399
- Joined: Sat Jan 12, 2002 2:00 am
Floating point error
I guess you can solve this by adding a small value
like printf("%lf",modf(pow(216,1/double(3))+1e-15,&s));
Cause is floating point error. The computer is interpreting the value as
5.999999... instead of 6
like printf("%lf",modf(pow(216,1/double(3))+1e-15,&s));
Cause is floating point error. The computer is interpreting the value as
5.999999... instead of 6