12.1 IsRat

IsRat( obj )

IsRat returns true if obj, which can be an arbitrary object, is a rational and false otherwise. Integers are rationals with denominator 1, thus IsRat returns true for integers. IsRat will signal an error if obj is an unbound variable or a procedure call.

    gap> IsRat( 2/3 );
    true
    gap> IsRat( 17/-13 );
    true
    gap> IsRat( 11 );
    true
    gap> IsRat( IsRat );
    false    # 'IsRat' is a function, not a rational 

Up Top Next
Index

GAP 3.4.4
April 1997