inprecise definition of pi

John W. Eaton jwe at bevo.che.wisc.edu
Tue Jan 8 20:23:54 CST 2008


On  8-Jan-2008, Henrik Holst wrote:

| To: bug at octave.org
| Cc: holst at matmech.com
| Subject: inprecise definition of pi
| 
| Bug report for Octave 2.9.12 configured for x86_64-pc-linux-gnu
| 
| Description:
| -----------
| 
| The definition of pi in Octave 2.9.12 is inprecise. 64-bit doubles can 
| give another correct digit.

The definition of pi is fine, though apparently you are not seeing as
many digits in the output as you'd like.

| octave2.9:1> format long
| octave2.9:2> pi
| ans =  3.14159265358979

You can see more digits if you use

  output_precision (16)

(for example).

| Fix:
| ---
| 
| Make Octave consistent with Matlab 7.4.0.336 (R2007a) 
| where we get another decimal:
| 
| >> format long
| >> pi
| 
| ans =
| 
|    3.141592653589793
| 
| >>  

That's not a fix, it's just a restatement of the behavior you'd like
to see.  A fix for this "problem" is attached below.  But since Octave
has displayed this number of digits for format long for almost 14
years now without complaints, I hesitate to make this change until I
hear from other users.

jwe


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diffs
Url: https://www.cae.wisc.edu/pipermail/bug-octave/attachments/20080108/dc97a872/attachment.ksh 


More information about the Bug-octave mailing list