{"id":37075648,"url":"https://github.com/zprolab/hpf","last_synced_at":"2026-01-14T08:54:09.523Z","repository":{"id":277813464,"uuid":"933568994","full_name":"zprolab/hpf","owner":"zprolab","description":"A high precision floating-point arithmetic module.","archived":false,"fork":false,"pushed_at":"2025-06-29T06:37:58.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-28T05:02:02.283Z","etag":null,"topics":["math","math-package","mathematics","maths","pypi-package","pypi-packages","python","python-math","python-maths","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/hpf/","language":"Python","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/zprolab.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2025-02-16T09:34:06.000Z","updated_at":"2025-06-29T06:33:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"0c999aaa-876e-41d1-b425-e6d551239e58","html_url":"https://github.com/zprolab/hpf","commit_stats":null,"previous_names":["zprolab/hpf"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zprolab/hpf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zprolab%2Fhpf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zprolab%2Fhpf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zprolab%2Fhpf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zprolab%2Fhpf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zprolab","download_url":"https://codeload.github.com/zprolab/hpf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zprolab%2Fhpf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414713,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["math","math-package","mathematics","maths","pypi-package","pypi-packages","python","python-math","python-maths","python3"],"created_at":"2026-01-14T08:54:08.734Z","updated_at":"2026-01-14T08:54:09.515Z","avatar_url":"https://github.com/zprolab.png","language":"Python","readme":"# High Precision Float (HPF) Platform\n\n\u003c!--![HPF Logo](your-logo-url-here) \u003c!-- Optional: Add a logo if available --\u003e \n\nA pure Python implementation of a high-precision floating-point arithmetic class, designed to handle mathematical operations with enhanced precision beyond standard floating-point limitations.\n\n## Features\n\n- **High Precision**: Arbitrary precision arithmetic for both integer and fractional parts.\n- **Multiple Initialization**: Supports initialization from `str`, `int`, and `float` types.\n- **Operator Overloading**: Full support for `+`, `-`, `*`, `/`, `//`, and comparisons.\n- **Negative Values**: Handles negative numbers with proper sign propagation.\n- **Custom Precision**: Optional precision setting for division operations.\n- **String Representation**: Clean string output with automatic trailing zero removal.\n\n## Installation\n\n### From PyPI\n\nUsing pip:\n```bash\npip install hpf\n```\n\n### From Source\n\n1. Use Source:\n\nSimply include the `hpf.py` file in your project and import the class:\n\n```python\nfrom hpf import HighPrecisionFloat  # or 'from hpf import hpf, HPF(both OK)'\n```\n\n2. Compile Yourself:\n\nThere are 2 methods: \n - Use setup.py\n```bash\ngit clone https://github.com/zprolab/hpf\ncd hpf \npip install setuptools\nsetup.py install # Auto Install!\n```\n - Use build (recommend)\n```bash\ngit clone https://github.com/zprolab/hpf\ncd hpf \nrm -rf ./dist\npip install setuptools build\npython -m build # Auto Build!\npip install dist/*.whl\n```\n\n## Usage\n\n### Test\n```bash\npython -m hpf\n```\n\n### Initialization\n```python\nfrom hpf import HighPrecisionFloat\n```\n\n### Abbreviations\n```python\nfrom hpf import HighPrecisionFloat as hpf\n```\nor\n```python\nfrom hpf import HighPrecisionFloat as HPF\n```\nor\n```python\nfrom hpf import hpf\n```\nor\n```python\nfrom hpf import HPF\n```\n\n```python\na = HighPrecisionFloat(\"3.14159265358979323846\", precision=25)\nb = HighPrecisionFloat(-42.75)\nc = HighPrecisionFloat(1000)\n```\n\n### Basic Arithmetic\n```python\nx = HighPrecisionFloat(\"10.5\")\ny = HighPrecisionFloat(\"3.2\")\n\nprint(x + y)  # 13.7\nprint(x - y)  # 7.3\nprint(x * y)  # 33.6\nprint(x / y)  # 3.28125\nprint(x // y) # 3\n```\n\n### Comparison Operations\n```python\na = HighPrecisionFloat(\"100.001\")\nb = HighPrecisionFloat(\"100.002\")\n\nprint(a \u003c b)   # True\nprint(a == b)  # False\nprint(a \u003e= b)  # False\n```\n\n### Sign Manipulation\n```python\nnum = HighPrecisionFloat(\"-123.45\")\nnum = -num  # Convert to positive\nprint(str(num)) # 123.45\n\nnum = +num  # Pos marking (no-op)\nprint(str(num))\n```\n\n### Precision Control\n```python\n# Set precision during initialization\ndiv1 = HighPrecisionFloat(\"22\", precision=50)\ndiv2 = HighPrecisionFloat(\"7\", precision=50)\nprint(str(div1/div2))\n```\n\n## Method Overview\n\n### Core Methods\n- `__init__`: Constructor with value parsing\n- `_add_abs/_sub_abs`: Internal absolute addition/subtraction\n- `_mul_abs/_div_abs`: Internal absolute multiplication/division\n- `_abs_greater`: Absolute value comparison\n\n### (TODO) Operator Overloads\n- `+`, `-`, `*`, `/`, `//`\n- `==`, `!=`, (TODO)`\u003c`, (TODO)`\u003c=`, (TODO)`\u003e`, (TODO)`\u003e=`\n\n### Utility Methods\n- `__str__/__repr__`: String representation\n- `neg()/pos()`: Sign manipulation\n\n## Considerations\n\n1. **Performance**: Operations on very large numbers or high precision settings may impact performance.\n2. **Division Precision**: The `precision` parameter in division defaults to 10 decimal places. Increase this for more precise results.\n3. **Zero Handling**: Trailing fractional zeros are automatically removed in string representation.\n\n## License\nMIT License - See [LICENSE](LICENSE) file for details.\n\n## Author\nChenyun Z. \nCreated: Oct 27 2024  \nLast Updated: Feb 18 2025\n\n## Something...\nPyPI is a great invention to make package-managing easier!\n\nGitHub Action is also a great invention to let we needn't to write `python -m build` again and again!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzprolab%2Fhpf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzprolab%2Fhpf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzprolab%2Fhpf/lists"}