On Tue, 9 Sep 2003, Leopold Toetsch wrote:
> Dan Sugalski <[EMAIL PROTECTED]> wrote:
> > On Tue, 9 Sep 2003, Leopold Toetsch wrote:
> >
> >> BTW PerlInt.divide() always yields a PerlNum, this seems bogus to me.
> >> I think we need some clarification for the PerlNum implementation.
>
> > That's right--perl math always ends up as floats.
>
> I'm not sure:
> FLAGS = (NOK,READONLY,pIOK,pNOK)
> FLAGS = (IOK,NOK,READONLY,pIOK,pNOK)
> AFAIK is (IOK, pIOK) the same as a real IV.
Internally it's sometimes not a float in new versions of perl, as Nicholas
pointed out, but unless the 'use integer' pragma's in effect, the math is
treated as if it were a floating point operation.
The IOK flag is an indication that the integer cache slot is valid--it
means that perl realized that the operation produces an integral value and
filled in the slot appropriately.
For us, teh equivalent would be returning a PerlInt if we find the
result produces an integral value, and a PerlNum if it doesn't. (Assuming,
of course, that the operation took place on two perl-style PMCs, as other
languages may have different rules on what happens)
Dan