Author: colomon
Date: 2010-06-11 17:10:23 +0200 (Fri, 11 Jun 2010)
New Revision: 31193
Modified:
docs/Perl6/Spec/S32-setting-library/Numeric.pod
Log:
[spec] Document Numeric.Real, Numeric.Int, Numeric.Rat, Numeric.Num, and
Real.Str.
Modified: docs/Perl6/Spec/S32-setting-library/Numeric.pod
===================================================================
--- docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-06-11 15:04:22 UTC
(rev 31192)
+++ docs/Perl6/Spec/S32-setting-library/Numeric.pod 2010-06-11 15:10:23 UTC
(rev 31193)
@@ -19,8 +19,8 @@
Created: 19 Mar 2009 extracted from S29-functions.pod
- Last Modified: 26 May 2010
- Version: 8
+ Last Modified: 11 June 2010
+ Version: 9
The document is a draft.
@@ -71,6 +71,35 @@
=over
+=item Real
+
+ our Real multi method Real ()
+
+If this C<Numeric> is equivalent to a C<Real>, return that C<Real>.
+(For instance, if this number is a C<Complex> with a zero imaginary part.)
+Fail otherwise.
+
+=item Int
+
+ our Int multi method Int ()
+
+If this C<Numeric> is equivalent to a C<Real>, return the equivalent of
+calling C<truncate> on that C<Real> to get an C<Int>.
+
+=item Rat
+
+ our Rat multi method Rat ( Real $epsilon = 1.0e-6 )
+
+If this C<Numeric> is equivalent to a C<Real>, return a C<Rat> which is
+within C<$epsilon> of that C<Real>'s value.
+
+=item Num
+
+ our Num multi method Num ()
+
+If this C<Numeric> is equivalent to a C<Real>, return that C<Real> as a C<Num>
+as accurately as is possible.
+
=item succ
our Numeric multi method succ ( Numeric $x: ) is export
@@ -174,30 +203,19 @@
=over
-=item Int
+=item Complex
- our Int multi method Int ()
+ our Complex multi method Complex ()
-Converts this C<Real> to an C<Int> as if C<truncate> had been called.
+Returns a C<Complex> whose real part is this C<Real> and whose imaginary part
is 0.
-=item Rat
+=item Str
- our Rat multi method Rat ( Real $epsilon = 1.0e-6 )
+ our Str multi method Str ()
-Converts this C<Real> to a C<Rat> with an accuracy of C<$epsilon>.
+Returns the C<Real> as a C<Str>. All built-in C<Real> types format it as a
decimal
+number, so for example, the C<Rat> C<5/4> is returned as C<"1.2">.
-=item Num
-
- our Num multi method Num ()
-
-Converts this C<Real> to a C<Num> as accurately as is possible for a C<Num>.
-
-=item Complex
-
- our Complex multi method Complex ()
-
-Returns a C<Complex> whose real part is this C<Real> and whose imaginary part
is 0.
-
=item floor
our Int multi method floor ( Real $x: ) is export