Repolode
sharkdp

sharkdp/numbat

A statically typed programming language and calculator for scientific computations with built-in physical dimensions and units.

Open-source alternative to:Wolfram AlphaQalculate

Stars
2,775
Forks
120
Open issues
131
Last commit
9 days ago

What is it?

Numbat is a programming language aimed at scientific calculations, where physical dimensions such as Length and Time act as types. The type system checks that calculations combine quantities correctly, and types can be declared explicitly or inferred.

Units are treated as first-class values. You can enter them in several notations (km/h, kilometer/hour, m^2), convert with the -> operator, define new units inline, and rely on the standard library, which covers SI, US customary, imperial, nautical, atomic and nuclear units along with many constants and functions. The standard library is itself written in Numbat and can be extended through an init.nbt file.

Numbat ships as a command-line tool with an interactive REPL that offers history, Ctrl-R search and tab completion, and it can also be tried in the browser. Its parser rejects ambiguous input with descriptive errors instead of guessing. It is a calculator, not a computer algebra system.

Key features

  • 01Physical dimensions such as Length and Time are used as static types with inference.
  • 02Units can be written in many forms and converted with the -> operator.
  • 03New units and functions can be defined in a few lines of code.
  • 04Standard library covers SI, imperial, nautical, astronomical and other unit systems plus constants.
  • 05Interactive REPL with history, reverse search and tab completion.
  • 06assert_eq checks exact or approximate equality of quantities at runtime.

Use cases

  • Checking unit consistency in physics or engineering calculations.
  • Quick one-off conversions between imperial, metric and other unit systems.
  • Writing calculation scripts where a wrong unit should be caught early.
  • Extending the unit system with custom domain-specific units.

Quick start

  1. 1

    Install the native CLI (see installation docs for details)

  2. 2

    Install the CLI from a local checkout

    cargo install -f --path numbat-cli
  3. 3

    Start the interactive REPL

    numbat

Things to know

  • Numbat is a scientific calculator, not a computer algebra system; it cannot solve differential equations or compute integrals.
  • There is no graphical user interface.

Topics

FAQ

What is numbat?
A statically typed programming language and calculator for scientific computations with built-in physical dimensions and units. Numbat is a programming language aimed at scientific calculations, where physical dimensions such as Length and Time act as types. The type system checks that calculations combine quantities correctly, and types can be declared explicitly or inferred.
Is numbat free to use? What license does it have?
numbat is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is numbat still maintained?
Actively maintained. The last commit to numbat was on Oct 11, 2026.
What can I use numbat for?
Checking unit consistency in physics or engineering calculations. Quick one-off conversions between imperial, metric and other unit systems. Writing calculation scripts where a wrong unit should be caught early. Extending the unit system with custom domain-specific units.
How do I install numbat?
Install the native CLI (see installation docs for details) Install the CLI from a local checkout: cargo install -f --path numbat-cli Start the interactive REPL: numbat
Where can I get numbat?
The source code and installation instructions are on GitHub: https://github.com/sharkdp/numbat

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects