in reply to Re^4: use64bitint in building Perl
in thread use64bitint in building Perl

Does anyone know if building perl with 64bitint means that ALL arithmetically-processed integers are stored in 8 bytes

The IV slot will always be 8 bytes - ie *all* integers will be stored in 8 bytes.

Cheers,
Rob

Replies are listed 'Best First'.
Re^6: use64bitint in building Perl
by cmac (Monk) on Dec 30, 2008 at 00:26 UTC
    Since I can't think of any variables in my web site that need > 32 bits, your reply has talked me out of building with use64bitint. Thank you for helping me with this decision.

    cmac
      Furthermore note that if numbers do go over 2 GB, Perl automatically upgrades you to floats, which can represent integers precisely up to 52 bits or so. Don't put undue trust in this because some floating point routines may introduce rounding errors, and the number is not always displayed exactly, but still floating point is not immediately worse than integer arithmetic.
        if numbers do go over 2 GB, Perl automatically upgrades you to floats

        If perl has been built with use64bitint and without uselongdouble, the "upgrade" can happen before the 2GB limit is reached ... which is definitely not what you want (as it means you've lost precision):
        $ perl -MDevel::Peek -le 'Dump(17 + (2 ** 56))' SV = NV(0x10450940) at 0x10410fd0 REFCNT = 1 FLAGS = (PADBUSY,PADTMP,NOK,READONLY,pNOK) NV = 7.2057594037928e+16
        In this instance, the workaround is to 'use integer':
        $ perl -Minteger -MDevel::Peek -le 'Dump(17 + (2 ** 56))' SV = IV(0x10429358) at 0x10410fdc REFCNT = 1 FLAGS = (PADBUSY,PADTMP,IOK,READONLY,pIOK) IV = 72057594037927953
        Just a little trap for the unwary.

        Cheers,
        Rob

        Update: Ooops - where *I* wrote 2GB above, I should have written "64-bit". And my point is unrelated to tilly's, anyway ....