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

2018-11-14 Thread sisyphus
On Thu, Nov 15, 2018 at 1:49 AM Tetsuo Handa < penguin-ker...@i-love.sakura.ne.jp> wrote: > 32bits userspace on 64bits kernel: > # truncate -s 9223372036854775807 test > # perl -e 'use File::stat; my $sb = lstat("test"); printf("%s\n", $sb->size);' > 9.22337203685478e+18 > # perl -e 'use File::sta

Re: Common regex for timedate

2018-11-14 Thread Andy Bach
> Yes the purpose is to compare the timestamps ans yes these are the only two formats . Then you probably want to look at modules, like Date::Manip, google has lots of suggestions: https://stackoverflow.com/questions/4199504/what-is-the-best-way-to-compare-dates-in-perl https://www.perlmonks.org/?

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 17592186044415 test # perl -e

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

2018-11-14 Thread sisyphus
On Wed, Nov 14, 2018 at 10:20 PM Tetsuo Handa < penguin-ker...@i-love.sakura.ne.jp> wrote: > Even on 32bit environments (at least for Linux), lstat() calls 64bit version When I check on Windows, I find that the value is actually an NV (not an IV as I had expected). I expect it's the same for you,

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: > > my $x = $sb->size; > $value = Math::BigInt->ne

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

2018-11-14 Thread sisyphus
On Wed, Nov 14, 2018 at 9:08 PM Tetsuo Handa < penguin-ker...@i-love.sakura.ne.jp> 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: my $x = $sb->size; $value = Math::BigInt->new("$x"); But doing so

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