Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Here's my code:
#!/tool/pandora/bin/perl5.8.0 use strict; use warnings; use Data::Dumper; use Math::BigFloat; print "sqrt(0.96303) = ".sqrt(0.96303)."\n"; my $value = Math::BigFloat->new(); $value += 0.9999; print "value = ".Dumper($value); my $sqrt_value = sqrt("$value"); #Works because $value is converted t +o a string. print "Stringified BigFloat sqrt($value) = $sqrt_value\n"; $sqrt_value = sqrt($value); #Hangs here because $value is less than 1 +. 99% CPU utilization print "BigFloat sqrt($value) = $sqrt_value\n";
janitored by ybiC: Balanced <code> tags around code as per Monastery convention
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sqrt of BigFloat 0<x<1
by pg (Canon) on Oct 07, 2003 at 02:08 UTC | |
|
Re: sqrt of BigFloat 0<x<1
by bart (Canon) on Oct 07, 2003 at 00:11 UTC | |
|
Re: sqrt of BigFloat 0<x<1
by Roger (Parson) on Oct 07, 2003 at 01:32 UTC | |
|
Re: sqrt of BigFloat 0<x<1
by Anonymous Monk on Oct 07, 2003 at 02:37 UTC |