From 88997f09e4b2e6ce41c374495af0818036a2d627 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 1 Apr 2013 23:22:37 +0200 Subject: [PATCH] bin/calc: Add s() to convert number to scientific notation. --- bin/calc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/calc b/bin/calc index c364119..9fa35d3 100755 --- a/bin/calc +++ b/bin/calc @@ -27,6 +27,10 @@ def ld(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 -- 2.44.1