"Brett W. McCoy" wrote:
>
> On Thu, 9 Aug 2001, Adam Carson wrote:
>
> > How is it not correctly rounding? It seems that it would consistently work
>(positive numbers only, of course, and that fix was already discussed). Is there
>another instance where it would not work?
>
> Never mind. I was looking at the wrong numbers. Adding .5 does
> correctly, except for negative numbers. Then you have to subtract .5.
>
> I ran a benchmark:
>
> Benchmark: running use_int, use_printf, each for at least 5 CPU seconds...
> use_int: 5 wallclock secs ( 5.19 usr + 0.00 sys = 5.19 CPU) @ 1427808.95/s
> (n=7406045)
> use_printf: 6 wallclock secs ( 5.29 usr + 0.00 sys = 5.29 CPU) @ 1204689.81/s
> (n=6369195)
>
> Using int(num +- .5) is a tad bit faster.
And just WHAT are you going to do with
all that extra time you're saving? :-)))
Ken
>
> -- Brett
> http://www.chapelperilous.net/btfwk/
> ------------------------------------------------------------------------
> Have at you!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]