From 7a2e8fb165386c164e70672c5863761c3e857e98 Mon Sep 17 00:00:00 2001 From: colomon Date: Mon, 7 Jun 2010 12:09:36 +0000 Subject: [PATCH] [spec] Change div and mod to be operators on integer types. git-svn-id: http://svn.pugscode.org/pugs@31159 c213334d-75ef-0310-aa23-eaa082d1ae64 --- docs/Perl6/Spec/S03-operators.pod | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/Perl6/Spec/S03-operators.pod b/docs/Perl6/Spec/S03-operators.pod index 468dfa981..5d335191c 100644 --- a/docs/Perl6/Spec/S03-operators.pod +++ b/docs/Perl6/Spec/S03-operators.pod @@ -15,8 +15,8 @@ Synopsis 3: PerlĀ 6 Operators Created: 8 Mar 2004 - Last Modified: 2 Jun 2010 - Version: 207 + Last Modified: 7 Jun 2010 + Version: 208 =head1 Overview @@ -748,12 +748,12 @@ that point.) =item * -C<< infix:
>>, generic division +C<< infix:
>>, integer division $numerator div $denominator Dispatches to the C<< infix:
>> 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 @@ general, other operators that might fail should also consider their use in hyperops and junctions, and whether they can profitably benefit from a lazy exception model.) -Use of C
on built-in integer types is equivalent to taking the -floor of a real division: +In general, C
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 @@ then calculates the remainder, which is defines as: =item * -C<< infix: >>, generic modulo +C<< infix: >>, integer modulo $x mod $y Dispatches to the C<< infix: >> 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 -- 2.11.4.GIT