Why not use Math.pow, which is known quality? Or even just test against actual answers calculated by a calculator? Testing something you've written against something else you've written is a bit dodgy.