Skip to content
UPEEC

Pint and uncertainties

Pint attaches physical units to numbers; uncertainties propagates measurement errors.

Easy
Comments 0
import pint
u = pint.UnitRegistry()
(5 * u.volt / (220 * u.ohm)).to(u.milliampere)        # 22.7 mA
from uncertainties import ufloat
ufloat(10.0, 0.5) * ufloat(2.0, 0.1)                   # 20.0 ± 1.4

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.