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.1.tar.gz (16.8 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.1-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for logscale-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2cf670437007619dcbdd30891eb1ce0bb2024dbfa24779f1e882891c9c7ae069
MD5 686ade2e8cec538f4852c15bb603998a
BLAKE2b-256 1bcf5684caba0232e1898f5c93d16fdac19b9b20886eaae199502425b48e4b36

See more details on using hashes here.

Provenance

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

Publisher: cd.yaml on cyrraz/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.1-py3-none-any.whl.

File metadata

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

File hashes

Hashes for logscale-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 35e89d5ae6fc3c4a09a863119a84e103e83f15728045fd69d733133fd14836d6
MD5 0fb4de851d3a35346a818c22401ae8b0
BLAKE2b-256 4dde96d53c757d13e1e08729e14bed56db23b87bbb58ddba7ef63c857616836a

See more details on using hashes here.

Provenance

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

Publisher: cd.yaml on cyrraz/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