File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change
1
+ = begin pod
2
+
3
+ = TITLE class FatRat
4
+
5
+ class FatRat is Cool does Rational[Int, Int]
6
+
7
+ A C < FatRat > is a rational number stored with arbitrary size numerator and
8
+ denominator. Arithmetic operations involving a C < FatRat > and optionally L < Int >
9
+ or L < Rat > objects return a C < FatRat > , avoiding loss of precision.
10
+
11
+ Since, unlike L < Rat > , FatRat arithmetics do not fall back L < Num > at some
12
+ point, there is a risk that repeated arithmetic operations generate
13
+ pathologically large numerators and denominators.
14
+
15
+ There are two common ways to generate C < FatRat > objects: through the
16
+ C < FatRat.new(Int, Int) > constructor, which generates them from numerator and
17
+ denominator, or by calling the C < .FatRat > method on an L < Int > or L < Rat >
18
+ object.
19
+
20
+ = end pod
You can’t perform that action at this time.
0 commit comments