Skip to content

Commit 25a4b5f

Browse files
committed
Rational
1 parent f6edbb6 commit 25a4b5f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/Rational.pod

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
=begin pod
2+
3+
=head1 Rational
4+
5+
role Rational[::NuT, ::DenomT] does Real { ... }
6+
7+
C<Rational> is the common role for numbers that are stored as pairs of
8+
numerator and denominator. It is parameterized by the types of the numerator
9+
and denominator.
10+
11+
Built into Perl 6 are L<Rat> and L<FatRat>, which both do the C<Rational> role.
12+
13+
=head2 methods
14+
15+
=head3 numerator
16+
17+
Returns the numerator.
18+
19+
=head3 denominator
20+
21+
Returns the denominator.
22+
23+
=head3 nude
24+
25+
Returns a list of the numerator and denominator.
26+
27+
=head3 norm
28+
29+
Returns a normalized Rational object, ie with positive denominator, and
30+
numerator and denominator coprime.
31+
32+
=end pod

0 commit comments

Comments
 (0)