up previous next
AsRAT

convert into a RAT

Syntax
AsRAT(N: INT): RAT
AsRAT(N: RAT): RAT
AsRAT(N: RINGELEM): RAT

Description
If the argument is a rational value this function returns this value as a RAT, otherwise it throws an error. Note that if the argument is actually an integer the result is nevertheless a RAT (with denominator 1).

Example
/**/  Use P ::= QQ[x,y];
/**/  type(LC(3*x-y));
RINGELEM
/**/ type(AsRAT(LC(3*x-y)));
RAT

See Also