in reply to Re: How to find out if it is 32bit or 64bit windows?
in thread How to find out if it is 32bit or 64bit windows?

That is the long version of how you can see that info :)

C:\Users\Tux>perl -V:ptrsize ptrsize='4'; C:\Users\Tux>perl -V:ivsize ivsize='4'; C:\Users\Tux>perl -V:nvsize nvsize='8'; C:\Users\Tux>

Note that ptrsize shows the size of the pointers. The length 8 indicates 64bit pointers. But even on 32bit perl installations, you can have 64bit integers: when perl was built with -Duse64bitint, and long doubles: when perl was built with -Duselongdouble.

To solve a problem that needs native huge numbers that do not fit in 32bit integers, having a perl that supports 64bit integers is often enough. Here's such a perl on a 32bit Linux with both

tux > perl -V:ptrsize ptrsize='4'; tux > perl -V:ivsize ivsize='8'; tux > perl -V:nvsize nvsize='12'; tux >

compare that to a build without -Duselongdouble on the same machine:

tux > perl5.8.8 -V:ptrsize ptrsize='4'; tux > perl5.8.8 -V:ivsize ivsize='8'; tux > perl5.8.8 -V:nvsize nvsize='8'; tux >

and this is on 64bit Linux:

tux > perl -V:ptrsize ptrsize='8'; tux > perl -V:ivsize ivsize='8'; tux > perl -V:nvsize nvsize='16'; tux >

to complete this info story, -V: accepts perl regular expressions:

$ perl -V:.*size charsize='1'; d_chsize='undef'; d_malloc_good_size='undef'; d_malloc_size='undef'; doublesize='8'; fpossize='16'; gidsize='4'; i16size='2'; i32size='4'; i64size='8'; i8size='1'; intsize='4'; ivsize='8'; longdblsize='16'; longlongsize='8'; longsize='8'; lseeksize='8'; nvsize='16'; ptrsize='8'; shortsize='2'; sig_size='69'; sizesize='8'; u16size='2'; u32size='4'; u64size='8'; u8size='1'; uidsize='4'; uvsize='8'; $

Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^3: How to find out if it is 32bit or 64bit windows?
by BrowserUk (Patriarch) on Jun 27, 2011 at 06:10 UTC
    That is the long version of how you can see that info :)

    Well yeah, but the "short version" isn't much use inside a program.

    For the rest.

    1. I know. The OP may not, be he also may not notice replies to me;
    2. when the OP asks about bits I think you can do no more than take him at his word.

      Generally, when people are concerned with the size of integers or numbers, they ask about them, not bits.

    nvsize='12';

    96-bit reals? I've encountered 32-bit, 64-bit, 80-bit and 128-bit, but never 96-bit. There isn't even an IEEE standard for those is there?

    Googling for "96-bit reals" turned up exactly 3 hits.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      It baffled me too, but as long as it works, and all my wanted CPAN modules work on it, why would I doubt? (a little stripped:)

      Linux 2.6.37.6-35-desktop/#1 HP EliteBook 8540p Core(TM) i5 CPU M 540 + @ 2.53GHz/2534(4) i686 3843 Mb openSUSE 11.4 "Celadon" $ gcc -dumpversion 4.5 $ gcc --version gcc (SUSE Linux) 4.5.1 20101208 [gcc-4_5-branch revision 167585] $ perl -V:.*size charsize='1'; doublesize='8'; fpossize='16'; gidsize='4'; i16size='2'; i32size='4'; i64size='8'; i8size='1'; intsize='4'; ivsize='8'; longdblsize='12'; longlongsize='8'; longsize='4'; lseeksize='8'; nvsize='12'; ptrsize='4'; shortsize='2'; sizesize='4'; u16size='2'; u32size='4'; u64size='8'; u8size='1'; uidsize='4'; uvsize='8'; $ perl -V (stripped) Summary of my perl5 (revision 5 version 14 subversion 1) configuration +: Platform: osname=linux, osvers=2.6.37.6-31-desktop, archname=i686-linux-64in +t-ld config_args='-Duse64bitint -Duselongdouble -des' use64bitint=define, use64bitall=undef, uselongdouble=define cc='cc', ccflags ='-fno-strict-aliasing -pipe -fstack-protector -I +/pro/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -fstack-protector -I/pro/loca +l/include' ccversion='', gccversion='4.5.1 20101208 [gcc-4_5-branch revision +167585]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off +_t='off_t', lseeksize=8 gnulibc_version='2.11.3' Characteristics of this binary (from libperl): Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_INT USE_LARGE_FI +LES USE_LONG_DOUBLE USE_PERLIO USE_PERL_ATOF

      Enjoy, Have FUN! H.Merijn
        It baffled me too

        On my linux box, my "-Duselongdouble" build of perl also reports an nvsize (and long double size) of 12 bytes.
        IIRC, that equated to 64 bits of precision for the mantissa, and 16 bits for the exponent and sign - the remaining 2 bytes being unused as far as I could tell.

        Of course, it may not be the same for you.

        Cheers,
        Rob
        Here are my results for Perl 5.16.3.1 64 bit, running on Windows 7 64 bit:

        >perl -V:.*size d_chsize='define'; d_malloc_good_size='undef'; d_malloc_size='undef'; doublesize='8'; fpossize='8'; gidsize='4'; i16size='2'; i32size='4'; i64size='8'; i8size='1'; intsize='4'; ivsize='8'; longdblsize='12'; longlongsize='8'; longsize='4'; lseeksize='8'; nvsize='8'; ptrsize='8'; shortsize='2'; sig_size='27'; sizesize='8'; st_ino_size='8'; u16size='2'; u32size='4'; u64size='8'; u8size='1'; uidsize='4'; uvsize='8';