| 
 
   
- 帖子
 - 254 
 - 精華
 - 0 
 - 威望
 - 2  
 - 魅力
 - 0  
 - 讚好
 - 0  
 
  | 
1#
 
發表於 2005-8-24 12:10 AM
 |  只看該作者
 
 
 
 
 Linux's Forgotten Gem: Calculator
forget about all the nice looking graphics, the quickiest programmable calculator in linux is bc. Start it with 
 
bc -l 
 
and you'll have a shell calculator with c-style instructions including 
=,+,-,*,/,%,++,--,>,<,>=,<=,==,!=,&&,|| 
 
s(x) is sine, c(x) is cosine, a(x) is atan, l(x) is ln, e() is exp, j(n,x) is bessel function 
 
EOF (ctrl-D) quits the program 
 
Also, you can use it in the shell (or in a script), for example 
localhost:~$ echo "(1+3)/5" | bc -l 
.80000000000000000000 
 
Finally, the -l flag is needed for floating point arithmetic, you can default this flag by putting the line 
alias bc='bc -l' 
in your shell start-up file 
 
you can use "man bc" to learn more about it |   
 
 
 
  |