🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

adaptive-floor

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

adaptive-floor

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

0.1.6
PyPI
Maintainers
1

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.

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts