Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-17 Thread Tetsuo Handa
Hello. I want to represent up to a few hundreds gigabytes for file size. On 32bits platform, I noticed that my $value = ...; printf("%u\n", $value); prints 4294967295 if $value >= 4294967295 whereas my $value = ...; printf("%s\n", $value); and use Math::BigInt; my $value = ...;

Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-17 Thread Tetsuo Handa
Hello. I want to represent up to a few hundreds gigabytes for file size. On 32bits platform, I noticed that my $value = ...; printf("%u\n", $value); prints 4294967295 if $value >= 4294967295 whereas my $value = ...; printf("%s\n", $value); and use Math::BigInt; my $value = ...;

Re: Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-15 Thread Tetsuo Handa
On 2018/11/15 9:27, sisyphus wrote: > Are you actually encountering files larger than 1e15 bytes ? On 32bit kernels, filesystems would not allow such large files. For example, max size for xfs filesystem is 16TB. Even on 64bit userspace, nobody will want to upload such large file via network. >

Re: Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-15 Thread Tetsuo Handa
have more questions or want more clarification, don't hesitate to ask again. Best regards, Peter On 2018/11/13 23:57, Mike Flannigan wrote: > > I don't have an answer for you, but I find this > interesting.  I note the same issue in 64bit > up near > 18446744073709551

Re: Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-14 Thread Tetsuo Handa
On 2018/11/14 21:46, sisyphus wrote: > On Wed, Nov 14, 2018 at 10:20 PM Tetsuo Handa > wrote: > >> Even on 32bit environments (at least for Linux), lstat() calls 64bit version > Here is some test results on Linux. 32bits userspace on 32bits kernel: # truncate -s 17592186044

Re: Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-14 Thread Tetsuo Handa
On 2018/11/14 19:59, sisyphus wrote: > On Wed, Nov 14, 2018 at 9:08 PM Tetsuo Handa > wrote > >> how can I pass $sb->size to Math::BigInt->new() as a string (assuming that >> $sb->size is an integer) ? > > To answer the question, you can do: > >

Re: Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-14 Thread Tetsuo Handa
Hello, sisyphus. Thank you for your answer. > That can fail if $value is so big that it requires more than 15 decimal > digits to express it accurately. I want to use like (...snipped...) my $sb = lstat($file) || next; next unless (S_ISREG($sb->mode) && $sb->size); (...snipped...) $cu

Strange behavior when printing a 4G+ integer on 32bits platform.

2018-11-13 Thread Tetsuo Handa
Hello. I want to represent up to a few hundreds gigabytes for file size. On 32bits platform, I noticed that my $value = ...; printf("%u\n", $value); prints 4294967295 if $value >= 4294967295 whereas my $value = ...; printf("%s\n", $value); and use Math::BigInt; my $value = ...;