I must have missed the original thread, but this one caught my eye.

I have a script that parses firewall log files and counts the bytes that
meet a certain criteria. Usually I do this in one month at a time and I
occasionally get negative numbers as answers when I get up over a few
billion bytes.

I started wondering if the way I was printing (I was using printf) had
anything to do with this.

I solved the problem by dividing all my lines by 1 million (I think I
actually used 1024*1024), which makes the report more readable anyways.
Instead of saying 

XXXX generated 3,453,452,235 bytes of traffic (which never worked anyways,
what I did get was:)
XXXX generated -2,245,321 bytes of traffic (which is obviously wrong).

I get:

XXXX generated 3,453 MB of traffic

But now I'm worried about rounding errors...although preciseness isn't
paramount, entries that generate much less than 1 MB now look goofy:

XXXY generated 0.003 MB of traffic

...but that's a different problem.

If anyone is really interested, I'll post the script...all 30 lines of it.

-r


-----Original Message-----
From: Ben Siders [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 22, 2003 2:37 PM
To: Christopher D. Lewis
Cc: [EMAIL PROTECTED]
Subject: Re: Size of number in scalar


You'll be waiting a long time.  Perl quickly moves into scientific 
notation and can handle arbitrarily large values.  I wrote a similar 
program a while back and got bored with it when the count hit about 
10^17. :)


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to