Licence
Creative Commons License

This work by Stephane KATTOOR is licensed under a Creative Commons Attribution 3.0 Unported License.
Feeling like tipping ?
If you find this blog useful, you might consider sending a few bitcoins to support it : 1BTtsC3beGJ6ysd8DhrXjdo6jVw5WD9mvY
RSS
 
RSS Feed
Follow me !
Tech@Sakana on Facebook
Search this site

Newsletter

Get latest posts by email (No spam, only posts):

Enter your email address:

Delivered by FeedBurner

Categories
Monthly archives
June 2007
M T W T F S S
« May   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  
Day: für den 20. June 2007
bc : 2 little tricks you’ve ever wanted to know - June 20, 2007 by Stephane Kattoor

If you’re looking for a good calculator on Linux / Unix, you can use bc. bc is “an arbitrary precision calculator” supporting bignumbers and many operators … well it will mostly do whatever you want (check the fine documentation).

Anyway, about those 2 little tricks I promised :

  1. change the scale variable (eg : scale=10) to set “the total number of digits after the decimal point”. Defaults to 0 -> Not cool.
  2. use the last variable to recall the last value you computed -> Cool.

That was it ! This is what I always need and forget, so I decided to blog it once for all…

If you really don’t know bc yet, give it a try !

Update: you can start bc with a default scale of 20 by using the “-l” option on the command line … (Thanks to Luke).

Who am I ?
Ads