The test proves that our calculator correctly calculates the 3rd root of 125, which is 5.

2.2. A Note On Accuracy

Below we can see an example of the accuracy that our workaround provides. The first output is the output of a function that uses Math.pow and the second is using our workaround:

The 3.0 root of 125.0 equals to 4.999999999999999.

The 3.0 root of 125.0 equals to 5.0.

3. Conclusion

The math workaround described above works really well with pretty good accuracy. In addition, it should be noted that this workaround is more efficient than other techniques that calculate the nth root using recursive or repetitive code.