Incorrect results from gmp-chudnovsky.c

tg at gmplib.org tg at gmplib.org
Tue Mar 17 12:53:04 UTC 2015


michael <michael.rychlik at rsm.ie> writes:

  I just compiled gmp-chudnovsky.c from the source file here:
  https://gmplib.org/download/misc/gmp-chudnovsky.c
  
  I find that when asked to produce 50,000,000 digits of PI the least significant 
  digit produced is wrong.
  
  $ ./gmp-chudnovsky 50000000 1 > pi_50000000.txt
  
  The output is:
  
  pi(0,7051366)=
  0.314159......9456526546e1
  
  The expected output is:
  
  pi(0,7051366)=
  0.314159......9456526545e1
  
Depends on your definition, I suppose.  The value printed is correctly
rounded.

In your opinion, should 5 digits of pi be 3.1415 or 3.1416?  And how
would you write 1 digit of 2-10^(-100) = 1.99999...?  Would that be "1"
to you?

  Additionally it is outputing the wrong number of digits. That last "46" are 
  actually the 50000001 and 50000002 digits of PI.
  
The two extra digits are for free.


Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list