More digits from octave
Hi, how can I get all the 15/16 digits from a command like pi = octave('pi')?
As far as I know, the "octave" command really just gets you an interface that allows you to pass strings as "typed in to octave" and get you back strings as printed by octave. So:
octave:1> 0.123456789 ans = 0.12346
suggests octave is naturally stingy with printing digits. In order to get more digits back via the octave interface, you should do whatever you do to normally coerce octave to print more digits. Perhaps https://www.gnu.org/software/octave/d... helps.
Starting Octave just to get a numerical value of pi is unnecessarily slow.
If you need a floating-point approximation to pi, I would suggest:
sage: pi = RDF.pi() sage: pi 3.141592653589793
But maybe you have other reasons to use Octave?
Asked: 2016-07-22 05:37:53 -0500
Seen: 107 times
Last updated: Jul 29 '16