This test makes sure NaN doesn't creep in due to Math.acos being called on numbers like +/- 1.000000000004, so it's more descriptive to check isNaN rather than the exact numerical results.
Also fixed handling of empty children array. Fixes #281.