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

> Your test is flawed.

see my updates in the meantime!

Cheers Rolf

Replies are listed 'Best First'.
Re^6: Infinity and Inf? (MAX_INT)
by tye (Sage) on Sep 01, 2010 at 13:53 UTC

    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.