#!/usr/bin/env bashThis script calculate the second argument at the command line with the precision of the first if there are exactly two arguments. If only one or more than three arguments are fed, the default precision is 4, with the first argument as the expression.
if [ $# -eq 2 ]
then
echo "scale=$1; $2"|bc
else
echo "scale=4; $1"|bc
fi
You can try jisuan 6 1/998001; jisuan 9 1/998001; ... jisuan 10000 1/998001 in a terminal, you will get
0.000001
0.000001002
0.000001002003
...
Oh, yes, this decimal recurs on [000 001 002 ... 999].
Another calculator in Emacs can be invoked by Alt-
没有评论:
发表评论