A good command line calculator program

learn more… | top users | synonyms

-1
votes
0answers
23 views

(standard_in) 1: syntax error with bc [closed]

I am running below script for simple arithmetic operation for floating values but getting: (standard_in) 1: syntax error with bc Script: echo "Please enter value 1: " read int1 echo "Please ...
0
votes
0answers
57 views

(standard_in) 1: parse error with bc

I am a new user bash. I want to divide two numbers, I used bc -l to take the decimals but I have this error: (standard_in) 1: parse error. This is my script: for res in {1..52} do cut ...
2
votes
3answers
329 views

Why doesn't `bc` utility exit with `^C`

I was using the bc utility recently and Ctrl+C cannot be used to exit the program. Ctrl+C's interrupt signal is returned with the message use quit to exit. I can use EOF (Ctrl+D) or quit to exit. I ...
1
vote
1answer
116 views

How to set default scale for bc calculator?

Ubuntu 14.04.1 LTS How do I set the default scale for the bc calculator? Each time I run bc I want scale=2 to be the default, I want to limit all calculations to 2 decimal places. I made a file in my ...
0
votes
1answer
230 views

Installing BC and any maths extension

I need to install "BC" (I think this is a language so I am guessing I need to install a parser but I seriously have no clue - would I need to install anything else?) onto Ubuntu 12.04 and any ...
10
votes
2answers
16k 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
1k 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 ...
15
votes
2answers
22k 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 ...
18
votes
7answers
49k 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
7answers
4k 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: ...