Date: 2009-11-17 18:43:12 +0100 (Tue, 17 Nov 2009)
New Revision: 29111
[S02] more Rat and Ratio clarification
--- docs/Perl6/Spec/S02-bits.pod 2009-11-17 17:28:47 UTC (rev 29110)
+++ docs/Perl6/Spec/S02-bits.pod 2009-11-17 17:43:12 UTC (rev 29111)
@@ -649,12 +649,11 @@
machines that are not natively 2's complement. You must convert to
and from C<Int> to do portable bitops on such ancient hardware.)
-(C<Num> may support arbitrary-precision floating-point arithmetic, but
-is not required to unless we can do so portably and efficiently. C<Num>
-must support the largest native floating point format that runs at full
+C<Num> must support the largest native floating point format that
+runs at full speed. It may be bound to an arbitrary precision type,
+but by default it is the same type as a native C<num>. See below.
-C<Rat> supports arbitrary precision rational arithmetic.
+C<Rat> supports extended precision rational arithmetic.
Dividing two C<Int> objects using C<< infix:</> >> produces a
a C<Rat>, which is generally usable anywhere a C<Num> is usable, but
may also be explicitly cast to C<Num>. (Also, if either side is
@@ -688,8 +687,14 @@
the Big Bang with picosecond precision. Though perhaps not with
-For applications that really need arbitrary precision denominators
-as well as numerators, C<Ratio> may be used, which is defined as C<Int/Int>.
+For applications that really need arbitrary precision denominators as
+well as numerators at the cost of performance, C<Ratio> may be used,
+which is stored as C<Int/Int>, that is, as arbitrary precision in
+both parts. There is no literal form for a C<Ratio>, so it must
+be constructed using C<Ratio.new($nu,$de)>. In general, only math
+operators with at least one C<Ratio> argument will return another
+C<Ratio>, to prevent accidental promotion of reasonably fast C<Rat>
+values into arbitrarily slow C<Ratio> values.