in reply to Re^3: negative numbers when doing multiplications? (float++)
in thread negative numbers when doing multiplications?

Part of the problem here may also be the printf "%d".  I just tried it (without use integer) on a 32-bit system/perl*, and the printf simply outputs -1, while print $degeneracy outputs the correct value without problems.

(AFAICT (i.e. using ltrace), Perl comes with its own printf implementation, and doesn't call the one provided by the system's libc, so this should be system-independent.)

___

* i686-linux, compilation settings from perl -V:

intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +2 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8

Replies are listed 'Best First'.
Re^5: negative numbers when doing multiplications? (float++)
by ikegami (Patriarch) on Mar 26, 2010 at 22:34 UTC

    Part of the problem here may also be the printf "%d".

    Yes, as I recently explained. Solution included.

      ...which made me wonder why printf "%d" (apparently) did work for tye — I''m assuming he used a 32-bit perl, because personally I cannot replicate the issue with use integer on any of the 64-bit perls that I tried.

        Good point. I think he has a 64-bit Perl and didn't do a control test.