"Alexey Trofimenko" <[EMAIL PROTECTED]> wrote:
>
> what do you think about adding C<div> operator, akin %, to perl6 core?
>
> I mean, as                $a   %  $b
>   really does          int($a)  %  int($b)
>   and returns modulous,
>
>          so                 $a div $b
>   really does      int( int($a) / int($b) )
>   and returns integer division.
>   but with native integers, declared as such, and with constants it should
> be optimized and done really fast
> yes, I realize that it wouldn't speed Perl up much, but I like idea that
> such a simple operation can be done using one simple machine instruction.
> And I use such a function often, but I hate that it uses floats
internally.
>
I'd imagine that if you declare a variable as an int, the compiler would be
able to generate optimal code for the % operator anyway, so you'd get the
speed you wanted.

Jonathan


Reply via email to