Пример #1
0
Int GAP_SizeInt(Obj obj)
{
    RequireInt("GAP_SizeInt", obj);
    if (obj == INTOBJ_INT(0))
        return 0;
    Int size = (IS_INTOBJ(obj) ? 1 : SIZE_INT(obj));
    return IS_POS_INT(obj) ? size : -size;
}
Пример #2
0
static Obj MPD_INT(Obj self, Obj i)
{
  Obj g;
  if (IS_INTOBJ(i)) {
    g = NEW_MPD(8*sizeof(long));
    mpd_set_si(MPD_OBJ(g), INT_INTOBJ(i), MPD_RNDNN);
  } else {
    Obj f = MPZ_LONGINT(i);
    g = NEW_MPD(8*sizeof(mp_limb_t)*SIZE_INT(i));
    
    mpfr_set_z(MPD_OBJ(g)->re, mpz_MPZ(f), GMP_RNDN);
    mpfr_set_ui(MPD_OBJ(g)->im, 0, GMP_RNDN);
  }
  return g;
}