bridge/class-master/depend/pari/src/basemath/Flx.c
/* If x is a POLMOD, assume modulus is a multiple of T. */
If x is a POLMOD, assume modulus is a multiple of T.
If x is a POLMOD assume modulus is a multiple of T .
GEN
Rg_to_Flxq(GEN x, GEN T, ulong p)
{
  long ta, tx = typ(x), v = T[1];
  GEN a, b;
  if (is_const_t(tx))
  {
    if (tx == t_FFELT) return FF_to_Flxq(x);
    return Fl_to_Flx(Rg_to_Fl(x, p), v);
  }
  switch(tx)
  {
    case t_POLMOD:
      b = gel(x,1);
      a = gel(x,2); ta = typ(a);
      if (is_const_t(ta)) return Fl_to_Flx(Rg_to_Fl(a, p), v);
      b = RgX_to_Flx(b, p); if (b[1] != v) break;
      a = RgX_to_Flx(a, p); if (Flx_equal(b,T)) return a;
      if (lgpol(Flx_rem(b,T,p))==0) return Flx_rem(a, T, p);
      break;
    case t_POL:
      x = RgX_to_Flx(x,p);
      if (x[1] != v) break;
      return Flx_rem(x, T, p);
    case t_RFRAC:
      a = Rg_to_Flxq(gel(x,1), T,p);
      b = Rg_to_Flxq(gel(x,2), T,p);
      return Flxq_div(a,b, T,p);
  }
  pari_err_TYPE("Rg_to_Flxq",x);
  return NULL; 
}
GEN Rg_to_Flxq ( GEN x , GEN T , ulong p ) { long ta , tx = typ ( x ) , v = T [ 1 ] ; GEN a , b ; if ( is_const_t ( tx ) ) { if ( tx == t_FFELT ) return FF_to_Flxq ( x ) ; return Fl_to_Flx ( Rg_to_Fl ( x , p ) , v ) ; } switch ( tx ) { case t_POLMOD : b = gel ( x , 1 ) ; a = gel ( x , 2 ) ; ta = typ ( a ) ; if ( is_const_t ( ta ) ) return Fl_to_Flx ( Rg_to_Fl ( a , p ) , v ) ; b = RgX_to_Flx ( b , p ) ; if ( b [ 1 ] != v ) break ; a = RgX_to_Flx ( a , p ) ; if ( Flx_equal ( b , T ) ) return a ; if ( lgpol ( Flx_rem ( b , T , p ) ) == 0 ) return Flx_rem ( a , T , p ) ; break ; case t_POL : x = RgX_to_Flx ( x , p ) ; if ( x [ 1 ] != v ) break ; return Flx_rem ( x , T , p ) ; case t_RFRAC : a = Rg_to_Flxq ( gel ( x , 1 ) , T , p ) ; b = Rg_to_Flxq ( gel ( x , 2 ) , T , p ) ; return Flxq_div ( a , b , T , p ) ; } pari_err_TYPE ( " " , x ) ; return NULL ; }
If x is a POLMOD, assume modulus is a multiple of T.
If x is a POLMOD assume modulus is a multiple of T .
/* LCOV_EXCL_LINE */