$ echo 1.2 2.34 + p | dc 3.54
$ echo 1.2 2.34 + 2 / p | dc 1
$ echo 2 k 1.2 2.34 + 2 / p | dc 1.77
Dc is a reverse-polish desk calculator which supports unlimited pre- cision arithmetic. It also allows you to define and call macros. Normally dc reads from the standard input;
Normally dc reads from the standard input; if any command arguments are given to it, they are filenames, and dc reads and executes the contents of the files before reading from standard input.
Printing Commands p Prints the value on the top of the stack, without altering the stack. A newline is printed after the value.
n Prints the value on the top of the stack, popping it off, and
does not print a newline after.Parameters Dc has three parameters that control its operation: the precision, the input radix, and the output radix.
i Pops the value off the top of the stack and uses it to set the
input radix.o Pops the value off the top of the stack and uses it to set the
output radix.k Pops the value off the top of the stack and uses it to set the
precision.