Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Re: time() function

by IraTarball (Monk)
on Sep 28, 2001 at 22:07 UTC ( [id://115461]=note: print w/replies, xml ) Need Help??


in reply to Re: time() function
in thread time() function

So, I understand this is true. I'm O.K. with overflows. I can handle overflows. But why does
$var = time * 1000;
overflow and
$var = time; $var *= 1000;
not overflow?

I believe that on my system (Win2k, perl 5.6.1) integers are 32 bit, just like returned by time() I verified this with print ($var&(~0)) which gives me (2**32)-1.

Does perl automatically decide (not) to use BigInts? Any ideas?

Ira,

"So... What do all these little arrows mean?"
~unknown

Replies are listed 'Best First'.
Re: Re: Re: time() function
by tachyon (Chancellor) on Sep 28, 2001 at 22:48 UTC

    time() is a Perl function, implemented in C with 32 bit (long int) math relevant to the unix epoch.

    A perl scalar is an interesting beast (also implemented in C) that can hold a string or a number or a reference so is not directly comparable to a short, int, long, float, double, char in C. It is in fact a struct. Have a look at this code and perlman:perlguts. On the Win95 box in front of me Perl will represent up to 2**49 (562,949,953,421,312) as an integer before resorting to scientific notation.

    for ( 0..64 ) { $var = 2**$_; print "Perl can do 2**$_ : $var\n"; }

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://115461]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found