Command-line calculators like bc and expr perform basic arithmetic reliably, but they fall short when handling complex unit conversions, currency conversions, or dimensional analysis. fend (Fast Extensible Number Dimension) is an open-source, arbitrary-precision calculation engine and CLI tool written in Rust. It allows developers, engineers, and sysadmins to evaluate complex expressions using natural language unit syntax directly in the terminal.
Why fend Outperforms Legacy CLI Calculators
Conventional Linux calculator utilities require manual conversion factors and external tables. In contrast, fend features a comprehensive built-in dimensional database and arbitrary-precision floating point arithmetic:
- Dimensional Unit Conversions: Seamlessly converts length, mass, velocity, time, temperature, energy, frequency, storage units, and electricity (e.g.,
50 knots in mphor200 joules in calories). - Compound Unit Arithmetic: Evaluates mixed physical operations, such as computing speed from distance divided by time (e.g.,
150 km / 2 hours to mph). - Data Rate and Storage Calculations: Converts networking and disk capacities effortlessly (e.g.,
100 gigabytes / 5 minutes to megabits/second). - Interactive and Pipeline Modes: Works both as an interactive read-eval-print loop (REPL) and as a non-interactive filter within shell scripts.
How to Install fend on Linux
You can install fend using multiple distribution packages or compile it directly via Cargo.
Method 1: Install via Cargo (Universal)
Ensure you have Rust and Cargo installed on your system:
cargo install fend
Method 2: Install on Ubuntu and Debian
Download the pre-built deb package from the official GitHub releases or install via snap:
sudo snap install fend
Method 3: Install on Arch Linux
On Arch Linux and derivatives, fend is available in the official repositories:
sudo pacman -S fend
How to Evaluate Expressions and Unit Conversions
You can execute fend directly from your terminal by passing expressions inside quotes:
1. Everyday Unit Conversions
fend "5 miles in km"
# Output: 8.04672 km
fend "100 degC in degF"
# Output: 212 degF
2. Compound Physical Calculations
fend "500 watts * 24 hours in kilowatt hours"
# Output: 12 kWh
fend "120 km / 1.5 hours in mph"
# Output: 49.70969537898 mph
3. Data Transfer and Storage Sizing
fend "50 gigabytes / 100 megabits per second in minutes"
# Output: 66.6666666666 minutes
Interactive REPL Mode
Launching fend without arguments starts an interactive session equipped with history navigation and auto-completion:
$ fend
> 2 ^ 16
65536
> _ * 2
131072
> exit
Common fend Commands and Syntax Reference
| Expression Type | Example Syntax | Resulting Dimension |
|---|---|---|
| Length / Distance | fend "5 km + 300 meters in feet" |
Calculates exact linear imperial footage. |
| Network Bandwidth | fend "1 gibibyte to mebibits" |
Converts binary data increments accurately. |
| Number Base Conversion | fend "0xFA in binary" |
Converts hexadecimal to base-2 binary strings. |