Front page | perl.perl5.porters |
Postings from July 2001
From: Norton Allen
July 6, 2001 13:31
Message ID: 200107062038.QAA04861@bottesini.harvard.edu
Nicholas Clark wrote:
> On Fri, Jul 06, 2001 at 03:38:36PM -0400, Norton Allen wrote:
> > Under Neutrino, I'm failing a test in op/arith.t.
> > The crux of the matter is:
> > perl -e '$x = 8589934590; print $x, "\n"'
> > produces '4294967294' (i.e. garbage). Where/how is that
> > large constant converted to an integer?
> toke.c:#if defined(Strtol) && defined(Strtoul)
> toke.c: iv = Strtol(PL_tokenbuf, (char**)NULL, 10);
> toke.c: Strtol() and Strtoul() are used above.
> I think, but I've not looked closed for some weeks.
> What do
> perl -e '$x = "8589934590"; print $x + 0, "\n"'
> perl -MPOSIX -e '$! = 0; $x = strtol("8589934590"); print "$!\n"'
> give you?
Yep, I tried that already.
> My hunch is that your strtol isn't setting errno correctly.
> [If this is right I'd expect my first to produce 8589934590 because runtime
> conversion is now done by Perl_grok_number in numeric, and the second NOT
> to return "Numerical result out of range"]
Results as you expect. I agree with your suspicions.
> If so you may want to see how uts/strtol_wrap.c is used.
> However, I think the long term (eg next 24 hours?) solution is to make
> toke.c use Perl_grok_number
I'll take a look. -Norton