3 ms·
bc -l is my standard command-line tool for arbitrary precision calculations (-l not needed here but handy for functions like sqrt(), e(), and log l() ): $
by tromp 3y ago
bc -l is my standard command-line tool for arbitrary precision calculations (-l not needed here but handy for functions like sqrt(), e(), and log l() ):
$ bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software
Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
9999999999999999.0 - 9999999999999998.0
1.0
- vaicorinthians 3y agobc is my calculator for pretty much everything for decades now. lol
- rnk 3y agowho does not use bc? people who aren't old unix people ;-) I use bc
- drougge 3y agoI consider myself an old unix person, but I use dc. Possibly to make it more confusing to anyone who looks at what I'm doing. It also gives the math result here of course. % dc 9999999999999999.0 9999999999999998.0 - p 1.0 %
- rnk 3y agorpn for for the win I guess ;-). I actually didn't get to try my first linux stuff until grad school in the 80s. I wish I had saved off all my init files from then to see what they look like now.
- rstuart4133 3y agoBack in the day (Unix Seventh Edition) bc was just a front end that compiled the expression and piped it to dc. My take it is most people didn't find rpn a win, and bc was the fix. I used bc's compiled output ("bc -c") to learn how to make dc jump through hoops. https://man.cat-v.org/unix_7th/1/bc https://man.cat-v.org/unix_7th/1/bc
- hanche 3y agoI guess old unix persons do use bc. But even older unix persons, like you and me, use dc. Oh, and I still have my trusty old HP48GX calculator that I bought nearly thirty years ago. Algebraic notation is fine for paper, bur RPN is best for calculating. I am glad I can even have an RPN calculator (PCalc) on my phone now.
- rnk 3y agoI got tired of typing bc -l years ago, I have a function so I can do it on the command line: calc 2^27 + 3^15. I wish somehow the shell would let me add parens here, instead of having to escape them with a quote. function calc2 { if [ $# -eq 0 ]; then echo 'pass commands for math evaluation, like calc l(2^32/17) + 3'; fi; echo $* | bc -l; }
- squigz 3y agoThis is what I've had in my bashrc for a few years: = () { printf "%'.f\n" $(echo $1 | bc); }; alias calc==