bridge/class-master/depend/pari/src/basemath/FpX_factor.c
/* assume x reduced mod p, monic. Return one root, or NULL if irreducible */
assume x reduced mod p, monic. Return one root, or NULL if irreducible
assume x reduced mod p monic . Return one root or NULL if irreducible
static GEN
FpX_quad_root(GEN x, GEN p, int unknown)
{
  GEN s, D, b = gel(x,3), c = gel(x,2);
  if (absequaliu(p, 2)) {
    if (!signe(b)) return c;
    return signe(c)? NULL: gen_1;
  }
  D = subii(sqri(b), shifti(c,2));
  D = remii(D,p);
  if (unknown && kronecker(D,p) == -1) return NULL;
  s = Fp_sqrt(D,p);
  if (!s) return NULL;
  return Fp_halve(Fp_sub(s,b, p), p);
}
static GEN FpX_quad_root ( GEN x , GEN p , int unknown ) { GEN s , D , b = gel ( x , 3 ) , c = gel ( x , 2 ) ; if ( absequaliu ( p , 2 ) ) { if ( ! signe ( b ) ) return c ; return signe ( c ) ? NULL : gen_1 ; } D = subii ( sqri ( b ) , shifti ( c , 2 ) ) ; D = remii ( D , p ) ; if ( unknown && kronecker ( D , p ) == -1 ) return NULL ; s = Fp_sqrt ( D , p ) ; if ( ! s ) return NULL ; return Fp_halve ( Fp_sub ( s , b , p ) , p ) ; }
assume x reduced mod p, monic.
assume x reduced mod p monic .
/* p is not prime, go on and give e.g. maxord a chance to recover */