Mark Chimley on Wed, 19 Sep 2001 19:27:08 +0100 (BST)

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: truncation

On Sat, 15 Sep 2001, Karim Belabas wrote:

> On Wed, 1 Aug 2001, Mark Chimley wrote:
> > I have been using simplify (ground (x)) to convert x (a polynomial with
> > complex coefficients) into one with integer coefficients. The polynomial
> > is an approximation to a class equation of an imaginary quadratic field,
> > so is known to reside in Z[X]. The problem is, when the coefficients
> > become suitably large, I get the error, "precision loss in truncation".
> > I have tried using precision (x, n) to increase the number of decimal
> > places in x prior to rounding, and although this seemed to overcome the
> > error, simplify (x) did not give a polynomial with integer coefficients.
> > 
> > I think an example might be appropriate to explain the problem better,
> > so I shall log some output. In the meantime, I shall post this message
> > to see if there is anything obvious that I am doing wrong, and to ask
> > exactly what "precision loss in truncation" means.
> You are trying to take the integral part (as a subroutine of round()) of a
> real number whose number of significant digits is too low for the operation
> to make sense, e.g round(1e30) at \p28 : 1e30 represents any real number x
> such that |x - 10^30| < 2^(99 - 3*32) = 8 [assuming 32bit machine;
> internally, we have significant bits, not digits: 1e30 has exponent 99 and
> \p28 translates to 3 significant words].  There is no unique integer with
> that property, hence the error message.
> What you need to do is to increase the precision of your data _before_
> starting the computation, e.g. increase 'realprecision' before computing your
> transcendental functions. Using 'precision' to increase the internal
> precision of an object is a hack that inserts essentially random significant
> digits.

Thanks for the advice, but although I have looked in the manual for a
description of how to increase the "realprecision" in a program using
the PARI library, the only reference seems to be to the global
variable, prec. This, however, doesn't seem to exist in my system.

Mark Chimley,
Department Of Mathematics,
University Of Bristol