bridge/class-master/depend/pari/src/basemath/gen2.c
/* returns 1 whenever x = 1, and 0 otherwise */
returns 1 whenever x = 1, and 0 otherwise
returns 1 whenever x = 1 and 0 otherwise
int
gequal1(GEN x)
{
  switch(typ(x))
  {
    case t_INT:
      return equali1(x);
    case t_REAL:
    {
      long s = signe(x);
      if (!s) return expo(x) >= 0;
      return s > 0 ? absrnz_equal1(x): 0;
    }
    case t_INTMOD:
      return is_pm1(gel(x,2)) || is_pm1(gel(x,1));
    case t_POLMOD:
      return gequal1(gel(x,2)) || gequal1(gel(x,1));
    case t_FFELT:
      return FF_equal1(x);
    case t_FRAC:
      return 0;
    case t_COMPLEX:
      return gequal1(gel(x,1)) && gequal0(gel(x,2));
    case t_PADIC:
      return !valp(x) && gequal1(gel(x,4));
    case t_QUAD:
      return gequal1(gel(x,2)) && gequal0(gel(x,3));
    case t_POL: return is_monomial_test(x, 0, &gequal1);
    case t_SER: return is_monomial_test(x, valp(x), &gequal1);
    case t_RFRAC: return gequal(gel(x,1), gel(x,2));
    case t_COL: return col_test(x, &gequal1);
    case t_MAT: return mat_test(x, &gequal1);
  }
  return 0;
}
int gequal1 ( GEN x ) { switch ( typ ( x ) ) { case t_INT : return equali1 ( x ) ; case t_REAL : { long s = signe ( x ) ; if ( ! s ) return expo ( x ) >= 0 ; return s > 0 ? absrnz_equal1 ( x ) : 0 ; } case t_INTMOD : return is_pm1 ( gel ( x , 2 ) ) || is_pm1 ( gel ( x , 1 ) ) ; case t_POLMOD : return gequal1 ( gel ( x , 2 ) ) || gequal1 ( gel ( x , 1 ) ) ; case t_FFELT : return FF_equal1 ( x ) ; case t_FRAC : return 0 ; case t_COMPLEX : return gequal1 ( gel ( x , 1 ) ) && gequal0 ( gel ( x , 2 ) ) ; case t_PADIC : return ! valp ( x ) && gequal1 ( gel ( x , 4 ) ) ; case t_QUAD : return gequal1 ( gel ( x , 2 ) ) && gequal0 ( gel ( x , 3 ) ) ; case t_POL : return is_monomial_test ( x , 0 , & gequal1 ) ; case t_SER : return is_monomial_test ( x , valp ( x ) , & gequal1 ) ; case t_RFRAC : return gequal ( gel ( x , 1 ) , gel ( x , 2 ) ) ; case t_COL : return col_test ( x , & gequal1 ) ; case t_MAT : return mat_test ( x , & gequal1 ) ; } return 0 ; }
returns 1 whenever x = 1, and 0 otherwise
returns 1 whenever x = 1 and 0 otherwise