Answer the question
In order to leave comments, you need to log in
Why does the pow function calculate the cube root this way?
Hello!
Quite by accident, I recently encountered the fact that the function pow(125, 1.0/3.0) as a result gives the answer 4.999999999999999991, and not 5. At the same time, the built-in cbrt function gives the correct answer. I'm just worried about the rest of the roots.
Can anyone explain why this happens (although I guess that it is possible as a result of dividing 1 by 3), and most importantly, what to do with it in other powers (for example, 1/7)?
Thank you!
PS But from 27 the cube root is correct
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question