Merge pull request #3 from dfong/master

eliminate use of dc
This commit is contained in:
wolfcw
2011-07-26 14:33:53 -07:00

View File

@@ -40,9 +40,21 @@ fakedate()
fakecmd "$1" date +$fmt
}
#
# compute x**n.
# use only the shell, in case we need to run on machines
# without bc, dc, perl, etc.
#
pow()
{
dc -e "$1 $2 ^ p"
typeset x="$1" n="$2"
typeset r=1
typeset i=0
while ((i < n)); do
((r = r*x))
((i++))
done
echo $r
}
# run a fakedate test with a given time t