bridge/class-master/depend/pari/src/basemath/arith1.c
/* allow k = NULL: maximal accuracy */
allow k = NULL: maximal accuracy
allow k = NULL : maximal accuracy
GEN
bestappr(GEN x, GEN k)
{
  pari_sp av = avma;
  if (k) { 
    switch(typ(k))
    {
      case t_INT:
        break;
      case t_REAL: case t_FRAC:
        k = floor_safe(k); 
        if (!signe(k)) k = gen_1;
        break;
      default:
        pari_err_TYPE("bestappr [bound type]", k);
        break;
    }
  }
  x = bestappr_Q(x, k);
  if (!x) { avma = av; return cgetg(1,t_VEC); }
  return x;
}
GEN bestappr ( GEN x , GEN k ) { pari_sp av = avma ; if ( k ) { switch ( typ ( k ) ) { case t_INT : break ; case t_REAL : case t_FRAC : k = floor_safe ( k ) ; if ( ! signe ( k ) ) k = gen_1 ; break ; default : pari_err_TYPE ( " " , k ) ; break ; } } x = bestappr_Q ( x , k ) ; if ( ! x ) { avma = av ; return cgetg ( 1 , t_VEC ) ; } return x ; }
allow k = NULL: maximal accuracy
allow k = NULL : maximal accuracy
/* replace by floor(k) */ /* left on stack for efficiency */