b921d7a68d
Yet another giant refactor PR. I'm trying to clean up the Context internals. I moved a lot of the fields into a new Registry object with the hopes of making future refactors to it easier. A lot of things are poorly named, and I've been going through and updating those. Some of these fields I didn't even know what they did until I studied them carefully, since I'd forgotten over time. This makes some breaking changes to the Defs serialization format, but I didn't touch Unit or Substance which are the only ones that are used by the backend currently. Some other refactors I did: - Updated quantities to no longer reference units, only base units and other quantities. - Added a debug dump option to the CLI for showing the contents of the Context. - Merged Def::BaseUnit & Canonicalization. - Merged Def::Prefix & SPrefix. I don't actually know what SPrefix stood for originally (standalone? definitely not short). - Prefixes are now required to be dimensionless. - Added missing tests for the Def serialization format. I'm not entirely done yet though. There's still one dependency on Context from the loader, which is on the eval() method, used by units and substances. I'm still thinking about how I can reduce that coupling. |
||
---|---|---|
.github/workflows | ||
cli | ||
core | ||
irc | ||
rink-js | ||
sandbox | ||
web | ||
.codecov.yml | ||
.gitignore | ||
.tokeignore | ||
.travis.yml | ||
Cargo.lock | ||
Cargo.toml | ||
LICENSE-GPL | ||
LICENSE-MPL | ||
README.md |
Rink
Rink is a unit-aware calculator. It can be used for physics and engineering calculations, as well as dimensionality analysis.
Rink supports most systems of measurements including SI, CGS, natural, international customary, US customary, UK customary, as well as historical measurements. In addition, Rink supports currency conversions.
Unique features:
- High-precision bignum rational arithmetic
- Detailed error messages
- Shows SI physical quantities
- Finds applicable SI derived units automatically
- Helps with dimensionality analysis, such as by offering unit factorizations and finding units for quantities.
- Open source
- First-class support for non-absolute temperature scales
Manual
Describes (hopefully) everything you need to know to use Rink's expression language.
Web Interface: rinkcalc.app
Rink is available via a web interface in addition to the terminal-based interface. Useful for doing calculations on mobile.
Install
The most common version of Rink is the command line interface rink
.
Package Manager | Command |
---|---|
Cargo | cargo install rink |
Pacman | pacman -S rink |
Nix | nix-env -i rink |
Scoop | scoop install rink |
Examples
> kWh/year -> W
0.1140795 watt (power)
> W -> J
Conformance error: 1 watt (power) != 1 joule (energy)
Suggestions: multiply left side by time, multiply right side by frequency
> gallon gasoline -> kWh
approx. 36.63388 kWh (energy)
> googol^100
1.0e10000 (dimensionless)
Library Usage
[dependencies]
rink-core = "0.6"
License
Rink source code is licensed under the Mozilla Public License, version 2. See LICENSE-MPL for details.
The data file definitions.units
is licensed under the GNU General
Public License, version 3. See LICENSE-GPL for details.
Contribution
Contribution guide can be found on the wiki: https://github.com/tiffany352/rink-rs/wiki#contribution-guide
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work will grant the rights lined out in the MPL, including larger works with secondary licenses.