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 ); }
void reduceint (lrs_mp Na, lrs_mp Da) /* divide Na by Da and return */ { lrs_mp Temp; copy (Temp, Na); exactdivint (Temp, Da, Na); }
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 */