Ejemplo n.º 1
0
void
reduce ( lrs_mp Na, lrs_mp Da ) { /* reduces Na Da by gcd(Na,Da) */
  lrs_mp Nb, Db, Nc, Dc;
  copy ( Nb, Na );
  copy ( Db, Da );
  storesign ( Nb, POS );
  storesign ( Db, POS );
  copy ( Nc, Na );
  copy ( Dc, Da );
  gcd ( Nb, Db );   /* Nb is the gcd(Na,Da) */
  exactdivint ( Nc, Nb, Na );
  exactdivint ( Dc, Nb, Da );
}
Ejemplo n.º 2
0
void 
reduceint (lrs_mp Na, lrs_mp Da)	/* divide Na by Da and return */
{
  lrs_mp Temp;
  copy (Temp, Na);
  exactdivint (Temp, Da, Na);
}
Ejemplo n.º 3
0
void
lcm ( lrs_mp a, lrs_mp b )
/* a = least common multiple of a, b; b is preserved */
{
  lrs_mp u, v;
  copy ( u, a );
  copy ( v, b );
  gcd ( u, v );
  exactdivint ( a, u, v );  /* v=a/u   no remainder*/
  mulint ( v, b, a );
}       /* end of lcm */