Board logo

標題: Linux's Forgotten Gem: Calculator [打印本頁]

作者: westsider    時間: 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
作者: slwong3    時間: 2005-8-24 11:22 AM

ok
thx for your tips on linux....
but I don't think no one would really care about it on here....

not much people are doing programming with linux on here...




歡迎光臨 娛樂滿紛 26FUN (http://26fun.com/bbs/) Powered by Discuz! 7.0.0