|Bill Allombert on Tue, 27 Sep 2005 19:00:45 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: setting output precision|
On Tue, Sep 27, 2005 at 05:42:31PM +0100, Prof. J. E. Cremona wrote: > Is there an easy way in gp to do computations to high precision (say, > 100) but only output in low precision (say, 10)? I know that I can > achieve this by adding lots of lines like > default(realprecision,100); > default(realprecision,10); > in my script, but thought there might be a better way of just turning > down the precision for output only. I think the "format" default is what you need: ? default("realprecision",100); realprecision = 105 significant digits (100 digits displayed) ? default("format","g0.10") format = g0.10 ? Pi %1 = 3.141592654 ? round(%*10^50) %2 = 314159265358979323846264338327950288419716939937511 The only problem I see is that you need to set it _after_ realprecision which seems strange. Cheers, Bill.