X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fcalc;h=f76472f00ef56512a0a873b78ca5dd99add244f4;hb=24ec064a7aa54ae8e5714b3f717f7ab5e40f20f3;hp=c3641191956eded9510788bf714523669d360aac;hpb=a0e89499b7a01724b8a2806805d8432e30e4aace;p=config%2Fdotfiles.git diff --git a/bin/calc b/bin/calc index c364119..f76472f 100755 --- a/bin/calc +++ b/bin/calc @@ -23,10 +23,16 @@ from math import * def ld(x): return log(x)/log(2) +def lg(x): + return log10(x) def binom(n,k): return reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1) +# Convert number to scientific notation (e.g. 5e6). +def s(x): + print "%e" % x + # Time/Date functions. import time