#!/usr/bin/perl use warnings; use strict; use Math::MPFR qw(:mpfr); use FileHandle; $|++; use constant MY_PI => 3.1415926535897932384626433832795028841971693993751; Rmpfr_set_default_prec(256); print Rmpfr_get_default_prec(),"\n"; my $n = Rmpfr_init2(256); # numerator my $d = Rmpfr_init2(256); # denominator my $r = Rmpfr_init2(256); # result my @barray; Rmpfr_set_d ($d, MY_PI , GMP_RNDD); my $s3 = Rmpfr_get_str($d,10,0, GMP_RNDD); print "$s3\n"; for (my $i = 0; $i < 1000; $i++){ $barray[$i] = Rmpfr_init2( 256 ); #init array element Rmpfr_set_d ($n, $i , GMP_RNDD); Rmpfr_div ($barray[$i], $n, $d, GMP_RNDD); } print "check mem, then hit a key\n"; <>; for (my $i = 0; $i < 1000; $i++){ Rmpfr_out_str($barray[$i],10,0,GMP_RNDD); syswrite STDOUT ,"\n"; # print "\n" dosn't work either STDOUT->flush(); } __END__ #### The bad output looks something like this: a bunch of numbers strung together a bunch of blank lines a bunch of numbers strung together a bunch of blank lines ....... ......