qalc
Perform calculations with physical units
TLDR
Launch in interactive mode
Launch in terse mode (print the results only)
Update currency exchange rates
Perform calculations non-interactively
List all supported functions/prefixes/units/variables
Execute commands from a file
SYNOPSIS
qalc
[options] [expression]
PARAMETERS
--evaluate, -e
Evaluate the given expression and exit. (This is the default if an expression is provided.)
--interactive, -i
Run qalc
in interactive mode, allowing continuous input of expressions.
--convert, -c
Convert the result of the expression to specified units or currencies (e.g., 10m -> ft
).
--terse, -t
Produce terse output, omitting the expression prefix and other decorative elements.
--precision, -p
Set the numeric precision for calculations.
--set, -s
Set internal variables or options (e.g., base=hex
or auto_post_conversion=off
).
--list-functions, -a
List all available mathematical functions supported by qalc
.
--list-units, -u
List all supported units and currencies.
--base, -B
Set the default output number base (e.g., binary
, octal
, hexadecimal
).
--help, -h
Display a help message and exit.
--version, -v
Show version information and exit.
DESCRIPTION
qalc
is the command-line interface for Qalculate!, a powerful and versatile desktop calculator. It provides advanced mathematical functionality directly in your terminal, supporting everything from basic arithmetic to complex symbolic calculations, unit conversions, currency exchange, and statistical analysis. Users can evaluate expressions non-interactively or enter an interactive mode for continuous calculations. Its extensive built-in function library, support for variables, and ability to handle arbitrary precision numbers make it an indispensable tool for engineers, scientists, and anyone needing robust calculation capabilities beyond simple bc
or expr
.
CAVEATS
qalc
relies on the Qalculate! library, which must be installed on the system. While extremely powerful, its comprehensive features can sometimes present a steeper learning curve compared to simpler calculators. Unit and currency exchange rates require occasional updates from online sources to remain accurate.
INTERACTIVE MODE
When run with no arguments or the -i
option, qalc
enters an interactive shell where users can type expressions continuously, define variables, create custom functions, and manage the calculation environment. This mode is ideal for complex, multi-step computations.
UNIT AND CURRENCY CONVERSION
One of qalc
's most powerful features is its robust unit and currency conversion capabilities. Expressions like 10 USD to EUR
or 50 miles / hour to km/s
are easily handled. It can automatically fetch up-to-date currency exchange rates and supports a vast library of physical units, making it invaluable for scientific and engineering calculations.
SYMBOLIC CALCULATIONS
Beyond numerical computation, qalc
can perform symbolic operations such as simplifying algebraic expressions, differentiating functions (e.g., diff(x^2 + 2x, x)
), and solving equations. This makes it a versatile tool for tasks that traditionally require more specialized mathematical software.
HISTORY
qalc
is part of the Qalculate! project, an open-source, multi-platform desktop calculator developed by Niklas Knutsson. The project began around 2001, aiming to provide a powerful and versatile calculator with a user-friendly interface. The command-line qalc
utility was developed alongside the GUI, offering the core calculation engine's capabilities to script and terminal environments, maintaining feature parity with the underlying library and ensuring consistent functionality.