in reply to Re: Why does printf() do this to big numbers?
in thread Why does printf() do this to big numbers?

On pretty much any platform out there, int is 32 bits

Not necessarily.  With a "64-bit perl", "%d" can handle ints larger than 32 bits just fine:

$ perl -e "printf qq(%d\n), 2810337464" 2810337464
$ perl -V ... intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=1 +6 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', + lseeksize=8 ... Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_64_BIT_ +ALL USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES ...

Replies are listed 'Best First'.
Re^3: Why does printf() do this to big numbers?
by fullermd (Vicar) on Mar 18, 2010 at 00:25 UTC

    Ah, true. I guess my C-brain leaks through sometimes :) I guess that's probably the USE_64_BIT_INT.

    But at any rate, overflow is what the OP is seeing.