Skip to main content

A lightweight Python library for precise number flooring and formatting. Includes adaptive decimal precision based on the fractional magnitude.

Project description

Adaptive Floor

A Python library for precise number flooring with adaptive decimal precision. It ensures accurate results without floating-point errors.

🚀 Features

  • Floor to Fixed Precision: Floors a number to a specific number of decimal places.
  • Adaptive Precision: Dynamically determines the required decimal places based on fractional magnitude.
  • Avoids Precision Loss: Uses decimal.Decimal for high accuracy.

📌 Installation

Clone the repository:

git clone https://github.com/tnam0x/adaptive_floor.git

or install via pip:

pip install adaptive-floor

📖 Usage

from adaptive_floor import adaptive_floor

# Floor a number to 3 decimal places
print(adaptive_floor(12.34567, 3))  # Output: 12.3456

# Adaptive flooring based on fractional part
print(adaptive_floor(0.004567))  # Output: 0.00456 (auto-determined decimals)

📜 License

This project is licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE file for details.

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

adaptive_floor-0.1.6.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

adaptive_floor-0.1.6-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file adaptive_floor-0.1.6.tar.gz.

File metadata

  • Download URL: adaptive_floor-0.1.6.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for adaptive_floor-0.1.6.tar.gz
Algorithm Hash digest
SHA256 7fb9ce8b06eef4787c6a90821fd488ab408ff60c36b1ccf81cddd13fb9d6a5c8
MD5 df9695f4b9d4f8e0023ed69bbfa772f3
BLAKE2b-256 b06db6ab6132aec6a56de3d724254af25cbfbf3146bfa923d576a81c3175dda0

See more details on using hashes here.

File details

Details for the file adaptive_floor-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: adaptive_floor-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for adaptive_floor-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c3cd2efc57f952f75d79bf4045cd76a30957d6f4e17447cacd077befc5c171c7
MD5 c407a56d95f5c968deda1c4107f3c60d
BLAKE2b-256 9ce5659dd036ab2370a13f0ba22728a18d596135b6319774e51a55c32b0a64a2

See more details on using hashes here.

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