in reply to Re^3: Infinity and Inf? (MAX_INT)
in thread Infinity and Inf?

The MAX_INT is somewhere between 2**49 and 2**50!

Your test is flawed. The maximum integer that can be accurately stored in a NV is 2**53 = 9007199254740992.

printf "%.15f\n", 2**53;; 9007199254740992.000000000000000

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.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^5: Infinity and Inf? (MAX_INT)
by LanX (Saint) on Sep 01, 2010 at 13:27 UTC
    > Your test is flawed.

    see my updates in the meantime!

    Cheers Rolf

      Your test is still flawed because MAX_INT is not MAX_UINT nor is it "the maximum of the range of integers that can be exactly stored in an NV". ~0 is MAX_UINT. MAX_INT is int(~0/2), which is 32 bits on some builds of Perl but not on others. See "IV".

      for( my $i= $start; 1; $i++ )

      Update: And it is usually spelt INT_MAX, it seems.

      - tye        

        > Your test is still flawed.

        see my updates in the meantime!

        Nota Bene: There are no restrictions of the range operator documented in perlop.

        > See "IV".

        Actually I'm expecting to work in a high level language which abstracts the implementation details away.

        Sure I could analyze the C-sources but thats not why I use Perl.

        > grep -l " IV " /usr/share/perl/5.10/pod/*.pod /usr/share/perl/5.10/pod/perlapi.pod /usr/share/perl/5.10/pod/perlguts.pod /usr/share/perl/5.10/pod/perlhack.pod /usr/share/perl/5.10/pod/perliol.pod /usr/share/perl/5.10/pod/perlreapi.pod /usr/share/perl/5.10/pod/perlxs.pod

        Cheers Rolf

        UPDATE:

        For those interested perlnumber holds some infos... especially:

        In fact numbers stored in the native integer format may be stor +ed either in the signed native form, or in the unsigned native for +m. Thus the limits for Perl numbers stored as native integers would typ +ically be -2**31..2**32-1, with appropriate modifications in the case +of 64-bit integers. Again, this does not mean that Perl can do op +erations only over integers in this range: it is possible to store many +more integers in floating point format.