On Thu, Sep 05, 2002 at 09:57:07AM -0400, Aaron Sherman wrote:
> On Thu, 2002-09-05 at 03:18, Leopold Toetsch wrote:
> > Brent Dax wrote:
> > 
> > > Aaron Sherman:
> > >   sub abs($num is int){ return $num>=0 ?? $num :: -$num }
> > >          ^^^^^^^^^^^^^
> > > I believe that should be (int $num).
> > 
> > 
> > and there is a ťabsŤ in core.ops.
> 
> I'll remove that then, and replace it with an INTERNAL comment

$num can be floating point too, but I think someone has covered that.
Is the internal abs smart enough to know (on a 32 bit system) what to do
with the abs of the integer -2**31 - ie:

perl -lwe 'print abs -2147483648'
2147483648

If I understand things correctly, all the parrot ops dealing in integer
registers keep the result in integer registers, floating point in floating
point registers. By default the perl6 language will carry on treating
numbers as "numbers" attempting to hide the underlying representation.

This is potentially slow, so I'd expect the perl6 interpreter/compiler to
try to find ways to generate integer or floating point bytecode whenever
it can get away with it. But it does have to be mindful of overflow.

(and tied variables, or whatever supercedes them, and %caller::MY)

Or am I mis-interpreting "INTERNAL", because in this context "INTERNAL"
refers to an op that uses PMCs already existing?

Nicholas Clark

Reply via email to