3 ms·
float precision issues make me nervous (although it's probably ok here), not to mention log() is kind of expensive compared to bit shifting why not just somet
by dhouston 19y ago
float precision issues make me nervous (although it's probably ok here), not to mention log() is kind of expensive compared to bit shifting
why not just something like
def fn(n):
ret=1;
while ret < n: ret <<= 1;
return ret
(news.yc/browsers mangle whitespace; proper formatting is left as an exercise to the reader)
- Goladus 19y agoTo format code, add a whole bunch of returns and then indent 4-5 spaces (5 returns and 6 spaces later whitespace does what I want) I think it's supposed to be 4 and 4, but I had some issues once and since then I just pile on returns and spaces until I get bored.
- nostrademons 19y agoI thought it's 2 and 1: print 'Hello world' Yup, that's it. A blank line before the indented block, then any amount of indentation. Reddit is 2 and 4.