What's the neatest way to convert a BIGINT to binary? I have some ideas but what's the most elegant?
-
Show this thread
-
can do it pretty easily in python but let me expand I ultimately want a string representation of a BIGINT decimal recast to binary eg 257 --> '10000001' but imagine larger powers of 2 much larger 2^(5000)
3 replies 0 retweets 10 likesShow this thread -
Replying to @eigenrobot
huh ''.join(reversed('1' if n >> i % 2 else '0' for i in range(ceil(log(n)/log(2))))) or something? (sql probably less good at oneliners than python is)
1 reply 0 retweets 1 like
Replying to @ded_ruckus
Yes extremely I just pull and postprocess shit like that
6:02 PM - 10 Feb 2020
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.