{"id":21626090,"url":"https://github.com/shtse8/ArbiMath","last_synced_at":"2025-07-17T11:31:33.990Z","repository":{"id":113833940,"uuid":"106699913","full_name":"shtse8/ArbiMath","owner":"shtse8","description":"A PHP 8.0 library for arbitrary precision mathematics using BCMath, featuring an immutable ArbiNumber class.","archived":false,"fork":false,"pushed_at":"2025-04-06T01:37:26.000Z","size":1177,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T13:13:36.471Z","etag":null,"topics":["arbitrary-precision","bcmath","immutable","library","math","number","php","php8"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shtse8.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-10-12T13:58:09.000Z","updated_at":"2025-04-06T01:55:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"cb3c3ad6-3626-44fe-82e0-a0f6a2a223f6","html_url":"https://github.com/shtse8/ArbiMath","commit_stats":null,"previous_names":["shtse8/sotimath"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shtse8/ArbiMath","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shtse8%2FArbiMath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shtse8%2FArbiMath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shtse8%2FArbiMath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shtse8%2FArbiMath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shtse8","download_url":"https://codeload.github.com/shtse8/ArbiMath/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shtse8%2FArbiMath/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265600578,"owners_count":23795718,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arbitrary-precision","bcmath","immutable","library","math","number","php","php8"],"created_at":"2024-11-25T01:12:09.695Z","updated_at":"2025-07-17T11:31:33.984Z","avatar_url":"https://github.com/shtse8.png","language":"PHP","funding_links":["https://buymeacoffee.com/shtse8"],"categories":[],"sub_categories":[],"readme":"# 🚀 ArbiMath PHP: Unleash Infinite Precision in Your PHP Applications! 🚀\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/shtse8/arbimath.svg?style=flat-square)](https://packagist.org/packages/shtse8/arbimath)\n[![Total Downloads](https://img.shields.io/packagist/dt/shtse8/arbimath.svg?style=flat-square)](https://packagist.org/packages/shtse8/arbimath)\n[![License](https://img.shields.io/packagist/l/shtse8/arbimath.svg?style=flat-square)](https://packagist.org/packages/shtse8/arbimath)\n\n**Tired of floating-point inaccuracies ruining your calculations? Need to handle numbers larger than your server's RAM?**\n\nStandard PHP math functions can hit limitations quickly, leading to subtle bugs and precision errors, especially in critical applications like finance, scientific computing, or cryptography.\n\n**✨ Enter ArbiMath PHP: Your ultimate weapon for high-precision mathematics in PHP! ✨**\n\nArbiMath PHP provides a robust, intuitive, and type-safe `ArbiNumber` class, built upon the battle-tested BCMath extension, allowing you to perform calculations with **virtually unlimited precision**. Say goodbye to precision headaches and hello to reliable results!\n\n## Why Choose ArbiMath PHP? 🤔\n\n*   **🎯 Uncompromising Precision:** Perform calculations with the exactness you demand. No more rounding errors, no more approximations. Perfect for financial systems, scientific simulations, and anywhere accuracy is paramount.\n*   **🐘 Handle HUGE Numbers Effortlessly:** Whether it's astronomical figures or complex cryptographic keys, ArbiMath PHP manages numbers of any magnitude with ease.\n*   **💻 Clean \u0026 Intuitive API:** A thoughtfully designed object-oriented interface makes complex math feel simple. Chain methods for elegant and readable code.\n*   **✨ Optional Operator Overloading:** Want to write `$a + $b` instead of `$a-\u003eadd($b)`? Install the (optional) PECL Operator extension and enjoy natural mathematical syntax!\n*   **⚡ Performance Optimized:** Leverages the highly optimized, low-level BCMath extension for reliable speed.\n*   ** nowoczesny PHP Ready:** Built for PHP 8.0+, embracing strict types and PSR-12 standards for modern development workflows.\n\n## Quick Start ⚡\n\n```php\n\u003c?php\n\nuse Shtse8\\ArbiMath\\ArbiNumber;\n\nrequire 'vendor/autoload.php';\n\n// Create numbers with insane precision or magnitude\n$pi = new ArbiNumber('3.1415926535897932384626433832795028841971');\n$largeNumber = new ArbiNumber('1.8573958822565E+50'); // Handles scientific notation!\n$smallIncrement = new ArbiNumber('0.0000000000000000000000000000000000000001');\n\n// Chain operations fluently\n$result = $largeNumber-\u003emul($pi)-\u003eadd($smallIncrement)-\u003epow('3');\n\necho \"Result: \" . $result-\u003etoString() . \"\\n\";\n// Need formatting?\necho \"Formatted: \" . $result-\u003eformat(10) . \"\\n\"; // Format with separators and 10 decimal places\n\n// With PECL Operator (Optional)\n// $result = ($largeNumber * $pi + $smallIncrement) ** 3;\n// echo $result;\n\n?\u003e\n```\n\n## Installation 🛠️\n\n1.  **Require via Composer:**\n    ```bash\n    composer require shtse8/arbimath\n    ```\n2.  **Ensure BCMath is Enabled:**\n    This extension is usually enabled by default, but if not:\n    ```bash\n    # Example for PHP 8.0 on Debian/Ubuntu:\n    sudo apt install php8.0-bcmath\n    # Or consult your OS/PHP documentation\n    ```\n3.  **(Optional) Install PECL Operator for Operator Overloading:**\n    *Note: This extension might require manual compilation and compatibility checks.*\n    ```bash\n    # General steps (adapt for your system):\n    # git clone https://github.com/php/pecl-php-operator\n    # cd pecl-php-operator \u0026\u0026 phpize \u0026\u0026 ./configure \u0026\u0026 make \u0026\u0026 sudo make install\n    # echo \"extension=operator.so\" | sudo tee /etc/php/8.0/mods-available/operator.ini\n    # sudo ln -s /etc/php/8.0/mods-available/operator.ini /etc/php/8.0/cli/conf.d/20-operator.ini\n    # sudo service php8.0-fpm reload # If using FPM\n    ```\n\n## Core Methods Overview 📚\n\nArbiMath PHP offers a comprehensive set of methods:\n\n*   **Arithmetic:** `add()`, `sub()`, `mul()`, `div()`, `mod()`, `pow()`\n*   **Comparison:** `isEqual()`, `isSmaller()`, `isGreater()`, `isSmallerOrEqual()`, `isGreaterOrEqual()`\n*   **Rounding/Truncating:** `round()`, `floor()`, `ceil()`, `truncate()`\n*   **Logarithms:** `ln()`, `log()`\n*   **Other Utilities:** `abs()`, `isNegative()`, `isPositive()`, `inc()`, `dec()`, `format()`, `getHumanValue()`, `getHumanUnit()`, `duplicate()`, `toString()` / `__toString()`\n\n*(Refer to the source code or future API documentation for detailed usage.)*\n\n## ❤️ Support The Project ❤️\n\nIf ArbiMath PHP helps you tackle complex calculations and saves you time, consider showing your appreciation! Your support helps maintain and improve this library.\n\n\u003ca href=\"https://buymeacoffee.com/shtse8\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## Contributing 🤝\n\nFound a bug or have a feature request? Contributions are highly welcome! Please feel free to open an issue or submit a Pull Request.\n\n## License 📄\n\nArbiMath PHP is open-source software licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshtse8%2FArbiMath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshtse8%2FArbiMath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshtse8%2FArbiMath/lists"}