Skip to main content

Compute orders of magnitude.

Project description

logscale

Actions Status Documentation Status

PyPI version Conda-Forge PyPI platforms

GitHub Discussion

Coverage

This Python package provides a single function, order_of_magnitude(), which computes and returns the order of magnitude of a given number in a standardized string format.

The order of magnitude gives a compact representation of a number as a product of a coefficient and a power of 10, where the coefficient is constrained to lie within the interval [1/√10, √10). For more information, see the wikipedia article on orders of magnitude.

Installation

If you are using uv, you can install the package from PyPI with:

uv pip install logscale

Alternatively, with regular pip:

pip install logscale

Examples

from logscale import order_of_magnitude

order_of_magnitude(129)  # "1.3e2"
order_of_magnitude(0.0001)  # "1.0e-4"
order_of_magnitude(456)  # "0.46e3"
order_of_magnitude(70.2)  # "0.70e2"
order_of_magnitude(0)  # "0.0e0"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logscale-0.1.5.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logscale-0.1.5-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file logscale-0.1.5.tar.gz.

File metadata

  • Download URL: logscale-0.1.5.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logscale-0.1.5.tar.gz
Algorithm Hash digest
SHA256 bdfdd96fedfac535334cecc34a08f72c0e9080e76fae9bd1ccd893fd67696461
MD5 cc2038990e3cfe4aed0d98164e2e9ffd
BLAKE2b-256 3a5eaf449242922dfd116074d8547fbd4ef55fc1890e5d6e05fff5d6b43d115e

See more details on using hashes here.

Provenance

The following attestation bundles were made for logscale-0.1.5.tar.gz:

Publisher: cd.yaml on 8-hat/logscale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file logscale-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: logscale-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for logscale-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ece127764bd593f6f05e3a47a33cfcf1d76e00eebf3d2fb3ddbca00838b25722
MD5 723a347a8e89677a6fdc2cf263933188
BLAKE2b-256 7d828e32be6585b81b3c19c06264084713e3e863a5c830ab1294085057aed391

See more details on using hashes here.

Provenance

The following attestation bundles were made for logscale-0.1.5-py3-none-any.whl:

Publisher: cd.yaml on 8-hat/logscale

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page