Greg Stark <gsst...@mit.edu> writes: > On Sat, Nov 20, 2010 at 6:31 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: >> Robert Haas <robertmh...@gmail.com> writes: >>> I had given some thought to whether it might make sense to try to >>> figure out how long the string will be before we actually start >>> generating it, so that we can just start in the exactly right space >>> and have to clean up afterward. But the obvious implementation seems >>> like it could be more expensive than just doing the copy.
>> Yeah. You certainly don't want to do the division sequence twice, >> and a log() call wouldn't be cheap either, and there don't seem to >> be many other alternatives. > There are bittwiddling hacks for computing log based 2. I'm not sure > it's worth worrying about to this degree though. I think converting log2 to log10 *exactly* would end up being not so cheap, anyhow. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers