Skip to content

Instantly share code, notes, and snippets.

@splat1745
splat1745 / calculator.py
Last active November 28, 2025 22:20
Uncertainty calculator
# Made this just to test gists lowk
import sympy
from sympy.parsing.sympy_parser import parse_expr, standard_transformations, convert_xor
def round_to_n_sig_figs(value, n=3):
"""
Round a number to n total significant figures (including the first non-zero digit).
Examples:
- 61.51 -> 61.5 (3 total sig figs)