Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.52 KB

README.md

File metadata and controls

53 lines (34 loc) · 1.52 KB

Python 3.8 License: MIT tox codecov Ruff

errbrac: Parse & format scientific error notations

🪽 Minimal dependencies: small and lightweight.

🔢 Using Decimal internally: no loss of precision.

Installation

📦 You can install the package via pip:

pip install git+https://github.com/EarlMilktea/errbrac

Usage

Parsing bracket notations

📈 Scientific notation is also supported.

from errbrac import ErrorBracket

# x.val == 1.23, x.err == 0.04, x.prec == 1
x = ErrorBracket.parse("1.23(4)")

# y.val == -2011, y.err == 20, y.prec == 2
y = ErrorBracket.parse("-2.011(20)E+3")

Formatting bracket notations

🤖 Output notation is automatically chosen based on values.

from errbrac import ErrorBracket

x = ErrorBracket.parse("1.23(4)")
print(x) # 1.23(4)

y = ErrorBracket.parse("-2.011(20)E+3")
print(y) # -2011(20)

License

📄 This package is licensed under the MIT license.