2024-05-17 22:37 UTC
  • Xyne


Description: A collection of scientific number classes for arbitrary precision, standard and custom units, and uncertainty for measured values.
Latest Version: 2021
Source Code: src/
  • any
  • python3
Build Dependencies:
  • python-setuptools
Arch Repositories:
  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]
AUR Page: python3-scinum
Arch Forum Thread: 151525


SciNum is a collection of classes and functions for working with scientific numbers in Python. Numerical values are represented internally using Decimal object. These are provided by the standard module decimal, which is Python’s implementation of the General Decimal Arithmetic Specification. That module provides context objects than can be used to determine the precision and behavior of arithmetic operations in different cases.

SciNum provides several classes that encapsulate the Decimal object:

The standard Decimal type with support for arbitrary units.
A numerical object that internally tracks its own precision and thus currectly represents significant figures in output.
This is just MeasuredDecimal with support for arbitrary units.
A numerical object that tracks its upper and lower bounds through all operations and thus represents the range within one can expect to find the value.
This is just UncertainDecimal with support for arbitrary units.



A wrapper around the decimal module that adds includes several of the recipes from the module’s homepage along with some convenience functions for extracting data from decimals.


The Unit class is used to represent arbitrary units. The module includes several functions for expressing given units in terms of arbitrary units and manipulating unit prefixes. Support is provided for SI units by default, but extension to any system of units should be straight-forward.

The module also provides a class named WithUnits that can be used to add units to any numerical value. This is how MeasuredDecimalWithUnits and UncertainDecimalWithUnits have been declared.


The declarations of the numerical classes, and functions for working with and interconverting them are located here. Most of the code is dedicated to managing properties across arithmetic operations.


See the examples on this page and the python3-nist page. Most if not all of the code has help text and useful comments.


The code is still fresh and not extensively tested. The internals will likely change a bit as everything settles, so consider this experimental for now. Keep a local copy if you come to rely on this for your own applications.



  • added basic support for siunitx string generation from units (MeasuredDecimal and UncertainDecimal are not yet supported)
echo | sed 's/\./@/'
XHTML 1.0 Strict CSS level 3 Atom 1.0