1

I need custom precision bits for t_REAL in Pari C library. I've tried changing the BITS_IN_LONG variable and made sure that I change that the precision exponent of my GEN variable, still I'm only getting a real number upto 39 decimal places. Is there a function or some different GEN type that can store real numbers with greater precision?

AdveRSAry
  • 187
  • 7

1 Answers1

1

There exists a default called realprecision which you need to set.

In PARI/GP you use the function default(realprecision, 1000) to change the number of (decimal) significant digits for t_REAL to 1000 (or maybe a bit more). Here the magical name realprecision is the "key", and 1000 is the "value".

And when I check the manual for default it says:

The library syntax is GEN default0(const char *key = NULL, const char *val = NULL).

So have you tried the function default0?

Jeppe Stig Nielsen
  • 60,409
  • 11
  • 110
  • 181
  • I tried changing the "realprecision" value, but it changed only by a factor of 32 bits (rounded). Moreover, it seemed to have a bound on the no. of significant bits. – AdveRSAry Jun 28 '17 at 10:42
  • @Deevashwer Did you change it to `1000` or what value? There should be no upper bound. I do not use the C library, but inside GP, when I do `default(realprecision, 1000)`, the value afterwards as seen with `default(realprecision)`, is `1001`. I use a 64-bit version. The help says: _Note that PARI's internal precision works on a word basis (by increments of 32 or 64 bits), hence may be a little larger than the number of decimal digits you expected._ Afterwards, when I do stuff like `exp(1.0)`, I get ~1000 figures. – Jeppe Stig Nielsen Jun 28 '17 at 10:53