Skip to main content

Compute orders of magnitude

Project description

logscale

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.2.tar.gz (17.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.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logscale-0.1.2.tar.gz
  • Upload date:
  • Size: 17.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.2.tar.gz
Algorithm Hash digest
SHA256 f28a03b2cbcacceb74e5076ea77a5903216a2140580bb01b662a7a1c76ed35ae
MD5 f354d4b788b3aaf362bbe9c4583618fb
BLAKE2b-256 155f1df4e841a63768a6c2cf5b51ae6b467ea3aa2337b86a873309d7d0f3130c

See more details on using hashes here.

Provenance

The following attestation bundles were made for logscale-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: logscale-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bb7e413566f79367f4b6af5e7bcddee9669bd796d3dfc439c283f3455db22c85
MD5 15221914846b499853420302b453c149
BLAKE2b-256 7b2e34f3bd831248c0e4b604fa8a3fa43fd8887d8eb357fa16eadb1e96826c0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for logscale-0.1.2-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