Hello.

Is there a better way to get the most accurate numeric value of a Perl
scalar?

   (void)SvIV(sv);
      /* to fill the IV slot if it's a string looking like a number */
   if (SvIOK_notUV(sv))
      SvIVX(sv) is the answer, type IV;
   else if (SvIOK_UV(sv))
      SvUVX(sv) is the answer, type UV;
   else
      SvNV(sv) is the answer, type NV;

It makes 123.0 an integer. I assume that for Perl 123.0 is in all counts
the same as 123, so it would make no sense to try to distinguish them
(they originally have different representations, but $x = 123; $y = $x +
1.5 and $x = 123.0; $y = $x + 1 make the representation of $x the same),
and it would also make no sense to distinguish numbers from strings
looking like numbers (they are exactly the same from the language's
point of view), right?

Is there a relatively easy way to handle various BigInt representations
as well?

How should I convert a very big int *to* Perl in a generic bridge
between two languages? I don't know if some BigInt package would be
in use, so I'm currently doing what the core Perl does: treat it as a
floating point number, possibly losing precision. Maybe it should be
customizable by providing a hook or something?

-- 
   __("<         Marcin Kowalczyk
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/

Reply via email to