Computer Hope

Other Pages

Home
Site map
Computer help

Dictionary
News
Q&A
What's new

Tools

E-mail this page
Print Preview
Edit this page



 

Linux / Unix dc command

Quick links

About dc
Syntax
Examples
Related commands
Linux / Unix main page

About dc

Short for desk calculator, dc is an arbitrary precision arithmetic package.

Syntax

dc [filename]

filename Input taken from file if required.

dc commands

p Prints current results
q Quits dc
c Clear all values on the stack
v Take square root
i Change input base; similar to bc ibase,
o Change output base; similar to bc obase.
k Set scale factor (number of digits after decimal); similar to bc scale.
! Remainder of line is a Unix command.

Examples

dc - Enters the desk calculator, below is a short example of what can be done:

1234 - Enter base value of 1234
1234
2 * p - Takes the value of 1234 times 2 and prints value
2468
468 - p - Takes the value of 2468 and subtracts 468
2000
2 / p - Takes the value of 2000 and divides by 2.
1000
v p - Takes the value of 1000 and square roots it.
31
q - Quits the desk calucator

Related commands

bc

 

Index

Category:
Linux / Unix

Companies:
Click here

Related Pages:

 

Resolved

Were you able to locate the answer to your questions?

Home - Computer help - Contact - Dictionary - Links
Link to Computer Hope - Bookmark Computer Hope