Author: colomon
Date: 2010-06-07 14:09:36 +0200 (Mon, 07 Jun 2010)
New Revision: 31159
Modified:
docs/Perl6/Spec/S03-operators.pod
Log:
[spec] Change div and mod to be operators on integer types.
Modified: docs/Perl6/Spec/S03-operators.pod
===================================================================
--- docs/Perl6/Spec/S03-operators.pod 2010-06-07 08:27:52 UTC (rev 31158)
+++ docs/Perl6/Spec/S03-operators.pod 2010-06-07 12:09:36 UTC (rev 31159)
@@ -15,8 +15,8 @@
Created: 8 Mar 2004
- Last Modified: 2 Jun 2010
- Version: 207
+ Last Modified: 7 Jun 2010
+ Version: 208
=head1 Overview
@@ -748,12 +748,12 @@
=item *
-C<< infix:<div> >>, generic division
+C<< infix:<div> >>, integer division
$numerator div $denominator
Dispatches to the C<< infix:<div> >> multi most appropriate to the
-operand types, typically returning a value of the same type.
+operand types, returning a value of the same type.
Not coercive, so fails on differing types.
Policy on what to do about division by zero is up to the type,
@@ -764,11 +764,12 @@
use in hyperops and junctions, and whether they can profitably benefit
from a lazy exception model.)
-Use of C<div> on built-in integer types is equivalent to taking the
-floor of a real division:
+In general, C<div> should give the same result as
$x div $y == floor($x/$y);
+but the return value should be the same type as $x.
+
=item *
C<< infix:<%> >>, modulo
@@ -782,15 +783,15 @@
=item *
-C<< infix:<mod> >>, generic modulo
+C<< infix:<mod> >>, integer modulo
$x mod $y
Dispatches to the C<< infix:<mod> >> multi most appropriate to
-the operand types, typically returning a value of the same type.
+the operand types, returning a value of the same type.
Not coercive, so fails on differing types.
-For built-in types, preserves the identity
+This should preserve the identity
$x mod $y == $x - ($x div $y) * $y