Hello. Understanding the language, the question of calculating the number root arose. I'm too lazy to write my function and thought there are standard ones. such as calculating the degree of it
Pow(Double, Double)
And calculating the square root
sqrt(Double)
I tried to score in pow
fractional degree corresponding to the desired root 1 / x. But the calculation is not accurate, moreover, the inaccuracy increases with the degree of the root. Example:
pow(1000.0, 1.0/3.0)
It should turn out 10
, and I receive 9.999999999999998
Maybe there is a standard, but I can not find. You can tell if this built-in function is available.
Functions I test on Swift’s online site.