Created
March 2, 2016 23:32
-
-
Save nicdoye/bb1738177b8ba3879d9f to your computer and use it in GitHub Desktop.
Ever wondered what the maximum size of a numeric (10**1000) in PostgreSQL looks like? Here you go. #pretty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p=1000;l=72;t=3;c=",";n="\n";z=0;w=" ";e=f="";P=p%l;(1..(4*l/t-(2+P+(P/t).floor))).each{|i|f+=w};(1..p).each{|i|q=(p-i+1);print(((i==1)?f.to_s+1.to_s():e)+(((q%t== 0)?c+((q%l==0)?n:e):e)+z.to_s)+((i==p)?n:e))}; |
Your version is 40% faster (Python 2.7.11 from homebrew vs Ruby 2.2.1p85 from RVM).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you taking patches for this ? :-)