Skip to content

Parse & format scientific error notations

License

Notifications You must be signed in to change notification settings

EarlMilktea/errbrac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Parse & format scientific error notations

Resources

License

Stars

Watchers

Forks

Languages