|Bill Allombert on Fri, 26 Oct 2012 22:50:33 +0200|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|Re: %Ps of t_REAL|
On Thu, Oct 25, 2012 at 11:26:17PM +0200, Bill Allombert wrote: > Hello PARI developers, > > ? \p10000 > realprecision = 10018 significant digits (10000 digits displayed) > ? a=Pi; > ? \p38 > realprecision = 38 significant digits > ? printf("%s",a) > 3.1415926535897932384626433832795028842 > > I know this is the documented behaviour but I cannot say I ever liked it. > I would much prefer to get 10018 digits. (If I wanted 38 digits, I would > do the computation to 38 digits, or I would write %.38s). > > It is worse in library mode where you do not have any control over > realprecision. It is especially painful with err_printf which is > used for debugging, when the interesting digits are discarded. We discussed about changing the behaviour, but there are two problems: 1) %g convert the data to t_REAL: ? printf("%g",12) 12.000000000000000000000000000000000000 2) "%s" does not allow to specify a precision. Instead: * s: Convert to a character string. If a precision is given, no more than the specified number of characters are written. ? printf("%.8s",[Pi,23]) [3.14159 So we are stuck. Cheers, Bill.