{"id":13408870,"url":"https://github.com/sharkdp/numbat","last_synced_at":"2025-05-13T17:14:06.677Z","repository":{"id":195961483,"uuid":"517024127","full_name":"sharkdp/numbat","owner":"sharkdp","description":"A statically typed programming language for scientific computations with first class support for physical dimensions and units","archived":false,"fork":false,"pushed_at":"2025-04-07T06:26:19.000Z","size":12833,"stargazers_count":1823,"open_issues_count":121,"forks_count":66,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-29T13:57:12.517Z","etag":null,"topics":["calculator","physics","programming-language","statically-typed","terminal-based","units","web-app"],"latest_commit_sha":null,"homepage":"https://numbat.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sharkdp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"sharkdp"}},"created_at":"2022-07-23T10:17:11.000Z","updated_at":"2025-04-29T12:47:47.000Z","dependencies_parsed_at":"2023-11-23T13:26:50.866Z","dependency_job_id":"510cfafc-656a-4310-8fc2-02da58065fcf","html_url":"https://github.com/sharkdp/numbat","commit_stats":{"total_commits":1105,"total_committers":19,"mean_commits":58.1578947368421,"dds":"0.10769230769230764","last_synced_commit":"ca4df99e10b10dd6b30e79903dc254e6370c7f8a"},"previous_names":["sharkdp/numbat"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fnumbat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fnumbat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fnumbat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sharkdp%2Fnumbat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sharkdp","download_url":"https://codeload.github.com/sharkdp/numbat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253990499,"owners_count":21995776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calculator","physics","programming-language","statically-typed","terminal-based","units","web-app"],"created_at":"2024-07-30T20:00:56.024Z","updated_at":"2025-05-13T17:14:01.630Z","avatar_url":"https://github.com/sharkdp.png","language":"Rust","funding_links":["https://github.com/sponsors/sharkdp"],"categories":["\u003ca name=\"calc\"\u003e\u003c/a\u003eCalculators","Rust","Calculators \u0026 Math"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"numbat-wasm/www/numbat.svg\"\u003e\n\n**[Try online!] • [Documentation] • [Tutorial] • [Syntax reference] • [Installation] • [Discord] • [Development]**\n\n[Try online!]: https://numbat.dev/\n[Features]: #key-features\n[Documentation]: https://numbat.dev/doc/\n[Tutorial]: https://numbat.dev/doc/tutorial.html\n[Syntax reference]: https://numbat.dev/doc/example-numbat_syntax.html\n[Installation]: https://numbat.dev/doc/cli-installation.html\n[Discord]: https://discord.gg/kAaVTsat4D\n[Development]: #development\n\n*Numbat* is a statically typed programming language for scientific computations\u003cbr\u003e\nwith first class support for physical dimensions and units.\n\n\u003c/div\u003e\n\n## Key Features\n\n\u003cimg src=\"assets/numbat-interactive.png\" align=\"right\"\u003e\n\n*Click to learn more.*\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003ePhysical dimensions as types\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat has a static type system where physical dimensions like `Length` and `Time` act as types.\nDefinitions of constants and functions can optionally contain type annotations that will be statically enforced.\nIf the types are not specified, they will be inferred (`Speed`, `Money` and `Frequency` in the screenshot).\n\nSee [this article](https://numbat.dev/doc/type-system.html) to learn more about Numbat's type system.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eFirst-class physical units\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat is focused on computations with units. Units are therefore treated as first-class citizens. They can be\n[entered in various ways](https://numbat.dev/doc/unit-notation.html) (`km/h` or `kilometer/hour`, `GiB` or\n`gibibytes`, `°` or `degree`, `m²` or `m^2`).\nNew units can be [introduced](https://numbat.dev/doc/unit-definitions.html) on the spot (`unit pixel`).\nCompatible units can be converted easily [using the `-\u003e` operator](https://numbat.dev/doc/unit-conversions.html) (`30 km/h -\u003e mph`, `1 mrad -\u003e degree`, `5 in + 2 ft -\u003e cm`, `27 weeks -\u003e days`).\nAnd unit expressions are simplified using various heuristics (`15 km/h * 30 min = 7.5 km`).\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eComprehensive standard library\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat's [standard library](https://numbat.dev/doc/prelude.html) comes with a large number of physical dimensions and units (SI, US Customary, Imperial, Nautical, Astronomical, Atomic, Nuclear, …).\nSee [this reference page](https://numbat.dev/doc/list-units.html) for a complete overview.\nIt also contains a lot of [mathematical and physical constants](https://numbat.dev/doc/list-constants.html)\nas well as a large range of [pre-defined functions](https://numbat.dev/doc/list-functions.html).\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eStrict syntax\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat's parser never tries to be \"smart\" on syntactically incorrect input.\nThis means you will either get a (descriptive) error message, or you can trust the result of your calculation.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eExcellent error messages\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat aims to provide [descriptive and helpful error messages](https://github.com/sharkdp/numbat/blob/master/assets/numbat-error.png).\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eInteractive terminal\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat has been designed for an interactive use-case with small \"one off\" computations. Opening the `numbat` interpreter\nwithout any arguments starts a [REPL](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop) with a familiar\nreadline interface, including all the usual features like a command history, Ctrl-R search or tab completion.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eModular and customizable\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nThe whole system of physical dimensions and units is specified Numbat's standard library, which is\n[written in the Numbat language](https://github.com/sharkdp/numbat/tree/master/numbat/modules) itself. It is therefore\neasily extensible by [providing a `init.nbt` file](https://numbat.dev/doc/cli-customization.html). For example,\na single line (`unit bathtub = 150 L`) is usually enough to add a new unit. Users can even choose to write their\nown `prelude` module, allowing for arbitrary modifications to the unit system.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eAssertions\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nWith its static type system, Numbat already enforces correctness of your calculations on a physical dimension level.\nBut some checks can only be made at runtime. Numbat provides an `assert_eq` procedure that allows you to check for\nexact equality using `assert_eq(12 ft, 1 in)` or approximate equality using `assert_eq(c, 300_000 km/s, 1% × c)`.\nThis can be useful to make sure that intermediate results do not change during a restructuring of your calculation.\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\u003cb\u003eNon-features\u003c/b\u003e\n\u003c/summary\u003e\n\u003cp\u003e\u003c/p\u003e\n\nNumbat is a scientific calculator. It's not a computer algebra system that solves differential equations\nor computes intergrals. Try [WolframAlpha](http://www.wolframalpha.com/) instead.\u003cbr\u003e\nThere is no graphical user interface with buttons like `x²`, `1/x` or `DEG/RAD`.\n[Qalculate!](http://qalculate.github.io/) is a fantastic tool that supports both text as well as graphical\ninput.\u003cbr\u003e\nNumbat supports a huge range of physical units. If you need something even more comprehensive,\nplease consider contributing. Or try [GNU units](https://www.gnu.org/software/units/).\n\u003c/details\u003e\n\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e\u0026nbsp;\u003c/p\u003e\n\n## Installation\n\nSee [this page](https://numbat.dev/doc/cli-installation.html) for details on how to install the native command-line version of Numbat.\n\n## Development\n\n[![CICD](https://github.com/sharkdp/numbat/actions/workflows/ci.yml/badge.svg)](https://github.com/sharkdp/numbat/actions/workflows/ci.yml)\n\nRun Numbat CLI\n```\ncargo run -- \u003cnumbat args\u003e\n```\n\nInstall the CLI version\n```\ncargo install -f --path numbat-cli\n```\n\nRun all tests\n```\ncargo test\n```\n\n### Working on the `prelude`\n\nIf you are working on [Numbat's standard library](numbat/modules/), it is convenient to point\nthe `NUMBAT_MODULES_PATH` environment variable to the `numbat/modules/` folder. This way,\nyou don't have to recompile Numbat to see your changes.\n\nAlternatively, you can create a symlink from `~/.config/numbat/modules` to the `numbat/modules/`\nfolder in the repository (see [this page](https://numbat.dev/doc/cli-customization.html#module-paths)\nfor the standard paths on other operating systems).\n\n## Contact us\n\nTo contact us, either [open a GitHub issue](https://github.com/sharkdp/numbat/issues/new/choose)\nor [discussion](https://github.com/sharkdp/numbat/discussions), or pop into our\n[Discord server](https://discord.gg/kAaVTsat4D).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Fnumbat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharkdp%2Fnumbat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharkdp%2Fnumbat/lists"}