📖 WIPIVERSE

🔍 Currently registered entries: 25,146건

dc (computer program)

dc is a desk calculator program, a command-line utility that operates as a reverse Polish notation (RPN) calculator. It's known for its powerful features and concise syntax, allowing for complex calculations and manipulation of numbers, including arbitrary-precision arithmetic.

It's a standard Unix utility and has been ported to numerous operating systems. Its simple yet versatile design makes it suitable for scripting, embedding in other programs, and use in situations where a powerful, yet compact, calculator is needed.

The program reads expressions from standard input and prints the result to standard output. It uses a stack to perform calculations; operators operate on the top elements of the stack. Numbers are pushed onto the stack, and operators pop values, perform the operation, and push the result back onto the stack.

Key Features:

  • Reverse Polish Notation (RPN): Unlike traditional infix notation, dc uses RPN, where operators follow their operands. This simplifies parsing and eliminates the need for operator precedence rules.
  • Arbitrary Precision Arithmetic: dc can handle numbers of virtually unlimited size, making it suitable for calculations requiring high precision.
  • Stack-Based Operations: The stack is central to dc's operation; all calculations and manipulations involve pushing and popping values from the stack.
  • Built-in Functions: dc offers a range of built-in functions for various mathematical operations, including arithmetic, logical operations and input/output manipulations.
  • Programmability: dc's commands can be combined to create more complex operations or even entire programs. This allows users to automate repetitive calculations and build custom tools.
  • Base Conversion: dc supports multiple number bases, allowing for easy conversion between decimal, hexadecimal, octal and binary representations.

See also:

  • [[Reverse Polish notation]]
  • [[bc (computer program)]] (a more user-friendly calculator program that often uses dc internally)

External Links:

  • (Add links to relevant man pages or other documentation here)