apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: approximating division by a million Re: Why not POSIX time_t?
Date Tue, 16 Jul 2002 13:51:24 GMT
Brian Pane wrote:
> Building upon Cliff's formulas, here's another idea
> for doing faster conversions of the current apr_time_t
> format to seconds:
> 
> What we want is t/1000000
> 
> What we can do easily is t/1048576
> 
> But what can we add to t/1048576 to approximate t/1000000?
> 
> If I solve for 'C' in
>   t/1000000 = t/1048576 + t/C
> I get C= ~21,586,297
> That's not a power of 2, but what if use 2^24 (~16M) as an
> approximation:
> 
> seconds = (t >> 20) + (t >> 24)
> 
> That probably isn't accurate enough, but you get the basic idea:
> sum a couple of t/(2^n) terms to approximate t/1000000.
> 
> What do you think?

I think you're all nuts. Are you seriously saying we compute time stuff 
often enough to care how long it takes?

Cheers,

Ben.

-- 
http://www.apache-ssl.org/ben.html       http://www.thebunker.net/

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff


Mime
View raw message