12.2 Numerator

Numerator( rat )

Numerator returns the numerator of the rational rat. Because the numerator holds the sign of the rational it may be any integer. Integers are rationals with denominator 1, thus Numerator is the identity function for integers.

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

Denominator (see Denominator) is the counterpart to Numerator.

Previous Up Top Next
Index

GAP 3.4.4
April 1997