Skip to main content

More Math!

Basic math functions that have been stabilized to act well over Null/None/NaN

Branch Status
master Build Status
dev Build Status

Overview

Many of the basic math functions you know and love, with the additional benefit that they do not throw exceptions and do not return NaN.

These functions are all module methods. Be sure you call the functions with mo_math. prefix, like

import mo_math
mo_math.abs(-42)

or rename the functions

from mo_math import abs as mo_abs
mo_abs(-42)

This prevents confusion with the __builtin__ functions by the same name

Functions

Functions are generally conservative in the face of nulls: Specifically, they return Null if any of their operands are not a number.

Most functions need no introduction, but some are interesting:

  • round(value, decimal=7, digits=None) - Rounds to 7 decimal points, unless specified differently. Rounding to decimal=0 will return an int. The useful parameter here is digits, which rounds to a specified number of significant digits.
  • floor(value, mod=1) - The modulo parameter is used to specify the granularity of the floor function.
  • ceiling(value, mod=1) - Return the smallest value, that's equal or larger than value, with suitable granularity.
  • mod(value, mod=1) - Works on floats
  • approx_str(value) - Round values, and return text (unicode in py2, str in py3)
  • sign(v) - Missing from the Python library

The all-caps aggregate functions accept only one parameter; an iterable. They are decisive operators: Non-numbers are ignored, if no values are numbers then the aggregate will return Null.

  • COUNT(values)
  • SUM(values)
  • PRODUCT(values)
  • MIN(values)
  • MAX(values)

Crypto

The AES and RSA crypto functions provide structured input/output on top of cryptography library. The intent is to reveal the signed/encrypted structures so third parties can decode the data.

Metadata

Release files for mo-math 7.685.25166

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mo-math 7.685.25166
File Size Uploaded Provenance
mo_math-7.685.25166.tar.gz 49.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mo-math 7.685.25166
File Interpreter ABI Platform
mo_math-7.685.25166-py3-none-any.whl Python 3 none any Details

Total release size: 105.4 kB

Release files / mo_math-7.685.25166.tar.gz

Download URL mo_math-7.685.25166.tar.gz
Size 49.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9c4d5d20959a59eb81d17c7f5b46f62334b6c005b8bb91f6a13c8d987cf16837
BLAKE2b-256 checksum
How to use checksums
43a39cf07fe47dd36c02d8040ce8dc63c27bc31f2fc4dd17a6238dde703203ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / mo_math-7.685.25166-py3-none-any.whl

Download URL mo_math-7.685.25166-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab9abdcaa94ec280d032fcb83715a956a4ebc088953d2478038753ddfe13b0d3
BLAKE2b-256 checksum
How to use checksums
edac1b4243e5f5686f96539611f3fd4a63dbbe67918cd4660c5571e801b7bb02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for mo-math 7.685.25166

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

7.685.25166 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page