in reply to Math::BigFloat

Here's a sample program that uses Math::BigFloat to compute square roots with the Newton-Raphson method. It will compute the square root of the argument you give it, 2 by default.

use Math::BigFloat; my $N = shift || 2; $g = Math::BigFloat->new($N); for (;;) { $g = ($g + ($N/$g))/2; print $g, "\n"; }

This is just a demonstration. Normally, a programmer using Math::BigFloat would use the ->fsqrt method to extract a square root.