Subject: RE: ipf counting and rrdtool
To: None <netbsd-users@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: netbsd-users
Date: 07/13/2001 03:31:23
[ On , July 13, 2001 at 01:07:01 (-0500), Bruce Anderson wrote: ]
> Subject: RE: ipf counting and rrdtool
>
> On Thu, Jul 12, 2001 5:01 PM, Greg A. Woods <mailto:woods@weird.com> wrote:
> >You might want to look at Ruby, Python, or even just plain /bin/sh & nawk
> >
> >I'd avoid gawk and mawk as they both corrupt large integers into floats,
> >and you're likely going to have to deal with large integers here!
> >
> >	$ nawk 'END {print 4294967296 + 4294967296}' < /dev/null
> >	8589934592
> >	$ gawk 'END {print 4294967296 + 4294967296}' < /dev/null
> >	8.58993e+09
> 
> Because gawk's
> OFMT default is "%.6g"

That's the same as nawk's too....

	$ nawk 'END {print OFMT}' < /dev/null
	%.6g

Oddly nothing I can find in gawk's manual talks about this weird
side-effect on "print" of changing OFMT....

Internally nawk appears to stores all numbers in C 'double' storage, but
cursory scanning of the source suggests that integer values are printed
as C 'long' integer values, while '%x', '%o', and '%u' are printed as C
'int' integer values (and '%lx' etc. are printed as C 'long' integers).

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>     <woods@robohack.ca>
Planix, Inc. <woods@planix.com>;   Secrets of the Weird <woods@weird.com>