bridge/class-master/depend/pari/src/basemath/base3.c
/* true nf, x a ZC (primitive for efficiency), embx its embeddings or NULL */
true nf, x a ZC (primitive for efficiency), embx its embeddings or NULL
true nf x a ZC ( primitive for efficiency ) embx its embeddings or NULL
static int
nfchecksigns_i(GEN nf, GEN x, GEN embx, GEN signs, GEN archp)
{
  long l = lg(archp), i;
  GEN M = nf_get_M(nf), sarch = NULL;
  long np = -1;
  for (i = 1; i < l; i++)
  {
    long s;
    if (embx)
      s = eval_sign_embed(gel(embx,i));
    else
      s = eval_sign(M, x, archp[i]);
    if (s < 0) 
    {
      long ni, r1 = nf_get_r1(nf);
      GEN xi;
      if (np < 0)
      {
        np = num_positive(nf, x);
        if (np == 0)  return oksigns(l, signs, i, 1);
        if (np == r1) return oksigns(l, signs, i, 0);
        sarch = nfarchstar(nf, NULL, identity_perm(r1));
      }
      xi = set_sign_mod_divisor(nf, vecsmall_ei(r1, archp[i]), gen_1, sarch);
      xi = Q_primpart(xi);
      ni = num_positive(nf, nfmuli(nf,x,xi));
      if (ni == 0)  return oksigns2(l, signs, i, 0);
      if (ni == r1) return oksigns2(l, signs, i, 1);
      s = ni < np? 0: 1;
    }
    if (s != (signs? signs[i]: 0)) return 0;
  }
  return 1;
}
static int nfchecksigns_i ( GEN nf , GEN x , GEN embx , GEN signs , GEN archp ) { long l = lg ( archp ) , i ; GEN M = nf_get_M ( nf ) , sarch = NULL ; long np = -1 ; for ( i = 1 ; i < l ; i ++ ) { long s ; if ( embx ) s = eval_sign_embed ( gel ( embx , i ) ) ; else s = eval_sign ( M , x , archp [ i ] ) ; if ( s < 0 ) { long ni , r1 = nf_get_r1 ( nf ) ; GEN xi ; if ( np < 0 ) { np = num_positive ( nf , x ) ; if ( np == 0 ) return oksigns ( l , signs , i , 1 ) ; if ( np == r1 ) return oksigns ( l , signs , i , 0 ) ; sarch = nfarchstar ( nf , NULL , identity_perm ( r1 ) ) ; } xi = set_sign_mod_divisor ( nf , vecsmall_ei ( r1 , archp [ i ] ) , gen_1 , sarch ) ; xi = Q_primpart ( xi ) ; ni = num_positive ( nf , nfmuli ( nf , x , xi ) ) ; if ( ni == 0 ) return oksigns2 ( l , signs , i , 0 ) ; if ( ni == r1 ) return oksigns2 ( l , signs , i , 1 ) ; s = ni < np ? 0 : 1 ; } if ( s != ( signs ? signs [ i ] : 0 ) ) return 0 ; } return 1 ; }
true nf, x a ZC (primitive for efficiency), embx its embeddings or NULL
true nf x a ZC ( primitive for efficiency ) embx its embeddings or NULL
/* 0 / + or 1 / -; -1 for FAIL */ /* failure */