bridge/class-master/depend/pari/src/basemath/base5.c
/* Given an element x and an ideal in HNF, gives an a in ideal such that
 * x-a is small. No checks */
Given an element x and an ideal in HNF, gives an a in ideal such that
x-a is small. No checks
Given an element x and an ideal in HNF gives an a in ideal such that x - a is small . No checks
static GEN
element_close(GEN nf, GEN x, GEN ideal)
{
  pari_sp av = avma;
  GEN y = gcoeff(ideal,1,1);
  x = nf_to_scalar_or_basis(nf, x);
  if (typ(y) == t_INT && is_pm1(y)) return ground(x);
  if (typ(x) == t_COL)
    x = closemodinvertible(x, ideal);
  else
    x = gmul(y, gdivround(x,y));
  return gerepileupto(av, x);
}
static GEN element_close ( GEN nf , GEN x , GEN ideal ) { pari_sp av = avma ; GEN y = gcoeff ( ideal , 1 , 1 ) ; x = nf_to_scalar_or_basis ( nf , x ) ; if ( typ ( y ) == t_INT && is_pm1 ( y ) ) return ground ( x ) ; if ( typ ( x ) == t_COL ) x = closemodinvertible ( x , ideal ) ; else x = gmul ( y , gdivround ( x , y ) ) ; return gerepileupto ( av , x ) ; }
Given an element x and an ideal in HNF, gives an a in ideal such that
 x-a is small.
Given an element x and an ideal in HNF gives an a in ideal such that x - a is small .