Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug report: bigfloat #740

Closed
p5pRT opened this issue Oct 19, 1999 · 3 comments
Closed

bug report: bigfloat #740

p5pRT opened this issue Oct 19, 1999 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 19, 1999

Migrated from rt.perl.org#1663 (status was 'resolved')

Searchable as RT1663$

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 1999

From jandrea@grassroots.ns.ca

perl -v shows
"This is perl, version 5.004_04 built for i386-linux"
on Debian GNU/Linux 2.1
kernelversion reports 2.0
on a fairly new Pentium(tm).

Code fails with many errors in BigFloat module,
"perl -w pi-big.pl"
shows many lines of

Use of uninitialized value at /usr/lib/perl5/Math/BigFloat.pm line 78.
Use of uninitialized value at /usr/lib/perl5/Math/BigFloat.pm line 96.
Use of uninitialized value at /usr/lib/perl5/Math/BigInt.pm line 189.
Use of uninitialized value at /usr/lib/perl5/Math/BigInt.pm line 259.

Sorry if the problem is fixed in 5_005, I tried searching the PerlbugDB via
the web, but it only reports "found 0, request failed".

#!/usr/local/bin/perl

use Math​::BigFloat;

$scale = 10;

$zero = new Math​::BigFloat "0.0";
$one = new Math​::BigFloat "1.0";
$two = new Math​::BigFloat "2.0";
$four = new Math​::BigFloat "4.0";
$root2 = $two->fsqrt( $scale );

print "$zero\n";
print "$one\n";
print "$two\n";
print "$four\n";
print "$root2\n";

$a = $one;
$x = $one;
$b = $one->fdiv( $root2, $scale );
$c = $one->fdiv( $four, $scale );
$y = $one;

print "$b\n";
print "$c\n";

$maxloop = 3;
$i = 0;

$prev = $zero;
$t = $one;
$t1 = $one;
$t2 = $one;

while( $i < $maxloop ) {
  $prev = $y;
  $y = $a;
  $t = $a * $b;
  $a = $t->fdiv( $two, $scale );
  $t = $b * $y;
  $b = $t->fsqrt( $scale );
  $t = $a - $y;
  $c = $c - $x * $t * $t;
  $x = $x * $two;
  $t = $a + $b;
  $t1 = $t * $t;
  $t2 = $c * $four;
  $y = $t1->fdiv( $t2, $scale );

# $t = $y->fround( $scale );
# $y = $y->fround( $scale );

  $i++;
  print "$y\n";
}

#eof

@p5pRT
Copy link
Author

p5pRT commented Aug 16, 2000

From @floatingatoll

This bug has changed slightly; running the test script with -w shows
a series of undefined warnings from line 96 of Math/BigFloat.pm.
Before, there were several warnings - so it's mostly fixed.

R.

[some snipping]

Sourceaddr​: John Andrea <jandrea@​grassroots.ns.ca>

Just goofing around and tried using BigFloat to calculate Pi to
lots of decimal places (code at very bottom of message).

perl -v shows
"This is perl, version 5.004_04 built for i386-linux"
on Debian GNU/Linux 2.1 kernelversion reports 2.0
on a fairly new Pentium(tm).

Code fails with many errors in BigFloat module,
"perl -w pi-big.pl" shows many lines of

Use of uninitialized value at
/usr/lib/perl5/Math/BigFloat.pm line 96.

[snip]

#!/usr/local/bin/perl

use Math​::BigFloat;

$scale = 10;

$zero = new Math​::BigFloat "0.0";
$one = new Math​::BigFloat "1.0";
$two = new Math​::BigFloat "2.0";
$four = new Math​::BigFloat "4.0";
$root2 = $two->fsqrt( $scale );

print "$zero\n";
print "$one\n";
print "$two\n";
print "$four\n";
print "$root2\n";

$a = $one;
$x = $one;
$b = $one->fdiv( $root2, $scale );
$c = $one->fdiv( $four, $scale );
$y = $one;

print "$b\n";
print "$c\n";

$maxloop = 3;
$i = 0;

$prev = $zero;
$t = $one;
$t1 = $one;
$t2 = $one;

while( $i < $maxloop ) {
$prev = $y;
$y = $a;
$t = $a * $b;
$a = $t->fdiv( $two, $scale );
$t = $b * $y;
$b = $t->fsqrt( $scale );
$t = $a - $y;
$c = $c - $x * $t * $t;
$x = $x * $two;
$t = $a + $b;
$t1 = $t * $t;
$t2 = $c * $four;
$y = $t1->fdiv( $t2, $scale );

# $t = $y->fround( $scale );
# $y = $y->fround( $scale );

$i++;
print "$y\n";
}

#eof

@p5pRT
Copy link
Author

p5pRT commented Aug 17, 2000

From @JohnPeacock

Check this again with the next build that Jarkko sends out. He recently
applied the patch I submitted which should fix all of those problems. I
see no more warnings running with my patched Math​::BigFloat and 5.6.0.

John Peacock

Richard Soderberg wrote​:

This bug has changed slightly; running the test script with -w shows
a series of undefined warnings from line 96 of Math/BigFloat.pm.
Before, there were several warnings - so it's mostly fixed.

R.

[some snipping]

Sourceaddr​: John Andrea <jandrea@​grassroots.ns.ca>

Just goofing around and tried using BigFloat to calculate Pi to
lots of decimal places (code at very bottom of message).

perl -v shows
"This is perl, version 5.004_04 built for i386-linux"
on Debian GNU/Linux 2.1 kernelversion reports 2.0
on a fairly new Pentium(tm).

Code fails with many errors in BigFloat module,
"perl -w pi-big.pl" shows many lines of

Use of uninitialized value at
/usr/lib/perl5/Math/BigFloat.pm line 96.

[snip]

#!/usr/local/bin/perl

use Math​::BigFloat;

$scale = 10;

$zero = new Math​::BigFloat "0.0";
$one = new Math​::BigFloat "1.0";
$two = new Math​::BigFloat "2.0";
$four = new Math​::BigFloat "4.0";
$root2 = $two->fsqrt( $scale );

print "$zero\n";
print "$one\n";
print "$two\n";
print "$four\n";
print "$root2\n";

$a = $one;
$x = $one;
$b = $one->fdiv( $root2, $scale );
$c = $one->fdiv( $four, $scale );
$y = $one;

print "$b\n";
print "$c\n";

$maxloop = 3;
$i = 0;

$prev = $zero;
$t = $one;
$t1 = $one;
$t2 = $one;

while( $i < $maxloop ) {
$prev = $y;
$y = $a;
$t = $a * $b;
$a = $t->fdiv( $two, $scale );
$t = $b * $y;
$b = $t->fsqrt( $scale );
$t = $a - $y;
$c = $c - $x * $t * $t;
$x = $x * $two;
$t = $a + $b;
$t1 = $t * $t;
$t2 = $c * $four;
$y = $t1->fdiv( $t2, $scale );

# $t = $y->fround( $scale );
# $y = $y->fround( $scale );

$i++;
print "$y\n";
}

#eof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant