A good command line calculator program

learn more… | top users | synonyms

4
votes
2answers
2k views

How to pass results of bc to a variable

I'm writing a script and I would like to pass the results from bc into a variable. I've declared 2 variables (var1 and var2) and have given them values. In my script I want to pass the results from ...
4
votes
3answers
727 views

Converting Celsius Processor Temperature to Fahrenheit

I'm editing a Conky theme. I would like it to output the processor temperatures in degrees Fahrenheit instead of Celsius. In the ~/.conkyrc file, the command sensors | grep 'Core 0' | cut -c18-19 is ...
7
votes
1answer
3k views

bc: set number of digits after decimal point

bc handles numbers as integers: # echo "100/3" | bc 33 bc -l handles numbers as floating point objects: # echo "100/3" | bc -l 33.33333333333333333333 Is there a way to limit the number of ...
7
votes
2answers
15k views

How to round decimals using bc in bash?

A quick example of what I want using bash scripting: #!/bin/bash echo "Insert the price you want to calculate:" read float echo "This is the price without taxes:" echo "scale=2; $float/1.18" |bc -l ...
10
votes
5answers
3k views

Command line calculator that keeps fractional values

I just found a good command line calculator program called bc and was satisfied with it until I discovered it rounds off fractional values, thus causing loss in precision. According to its man page: ...