Andrew Howroyd: No need to use unsafe floating point for this - compare pari above.
Georg Fischer: On author's request.