12.3 Denominator

Denominator( rat )

Denominator returns the denominator of the rational rat. Because the numerator holds the sign of the rational the denominator is always a positive integer. Integers are rationals with the denominator 1, thus Denominator returns 1 for integers.

    gap> Denominator( 2/3 );
    3
    gap> Denominator( 66/123 );
    41    # numerator and denominator are made relatively prime
    gap> Denominator( 17/-13 );
    13    # the denominator holds the sign of the rational
    gap> Denominator( 11 );
    1    # integers are rationals with denominator 1 

Numerator (see Numerator) is the counterpart to Denominator.

Previous Up Top Next
Index

GAP 3.4.4
April 1997