{"id":19594508,"url":"https://github.com/schlopp96/setprecision","last_synced_at":"2026-03-04T23:32:23.137Z","repository":{"id":40988539,"uuid":"480123593","full_name":"schlopp96/SetPrecision","owner":"schlopp96","description":"Python module providing an easy way to set the precision of a floating-point number to the desired amount of decimal places, or total amount of significant digits.","archived":false,"fork":false,"pushed_at":"2024-07-16T05:40:52.000Z","size":47,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-03T21:07:15.791Z","etag":null,"topics":["decimal-places","decimals","floating-point","function","math","precision","python","python-functions","python-module","python-script","python3","rounding","script","sig-figs","significant-digits"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/schlopp96.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}},"created_at":"2022-04-10T19:49:10.000Z","updated_at":"2022-09-19T01:09:16.000Z","dependencies_parsed_at":"2022-09-13T06:50:15.868Z","dependency_job_id":null,"html_url":"https://github.com/schlopp96/SetPrecision","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlopp96%2FSetPrecision","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlopp96%2FSetPrecision/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlopp96%2FSetPrecision/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/schlopp96%2FSetPrecision/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/schlopp96","download_url":"https://codeload.github.com/schlopp96/SetPrecision/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787487,"owners_count":20020099,"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":["decimal-places","decimals","floating-point","function","math","precision","python","python-functions","python-module","python-script","python3","rounding","script","sig-figs","significant-digits"],"created_at":"2024-11-11T08:43:46.394Z","updated_at":"2025-12-02T05:03:22.284Z","avatar_url":"https://github.com/schlopp96.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SetPrecision\n\n## About\n\n- _**`SetPrecision`**_ is a small module providing a simple way to set the precision of a floating point number or decimal to the desired amount of digits following the decimal point.\n\n---\n\n## Installation\n\n### Using PIP _(Recommended)_\n\n\u003e _Easiest_ method. Highly recommended over manual installation.\n\n- To install _**`SetPrecision`**_ using `pip`, enter the following:\n\n  ```python\n  python -m pip install SetPrecision\n  ```\n\n- Done!\n\n---\n\n### Manual Installation\n\n\u003e _Not_ recommended.\n\n1. Before use, navigate to intended installation location, and create a new directory.\n\n2. Clone repository with the git client of your preference using the following command:\n\n   - ```bash\n     git clone https://github.com/schlopp96/SetPrecision/releases/latest\n     ```\n\n3. Install all dependencies for this package within said directory using:\n\n   - ```bash\n     pip install -r requirements.txt\n     ```\n\n- **(Optional)**: move installation directory to `\"path/to/Python/Libs/site_packages\"` to be able to import this package to a Python program like any other importable package.\n\n- Done!\n\n---\n\n## Usage\n\n- In order to use _**`SetPrecision`**_, start by importing the module to your Python environment:\n\n  ```python\n  from SetPrecision import set_precision\n  ```\n\n- Now, simply call the `set_precision` method and enter your desired number to be formatted as the `number` parameter, and the level of precision as the `precision` parameter:\n\n  ```python\n\n  \u003e\u003e\u003e testA = 3.141592653589793 # Not necessary to set number as variable.\n\n  \u003e\u003e\u003e testA = set_precision(testA, 2)\n\n  \u003e\u003e\u003e print(testA)\n\n  '3.15'\n\n  \u003e\u003e\u003e testB = 3.141592653589793\n\n  \u003e\u003e\u003e testB = set_precision(testB, 4)\n\n  \u003e\u003e\u003e print(testB)\n\n  '3.1416'\n  ```\n\n\u003e Note that the output is automatically rounded up when `number \u003e= 5`, and down when `number \u003c 5`.\n\n- Both params can be entered in string format, and will output successfully assuming that both parameters can be cast to their appropriate types.\n  - This is done automatically.\n\n---\n\n## Contact the Author\n\n- If you have any questions, comments, or concerns that cannot be alleviated through the [project's GitHub repository](https://github.com/schlopp96/SetPrecision), please feel free to contact me through my email address:\n  - `schloppdaddy@gmail.com`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschlopp96%2Fsetprecision","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fschlopp96%2Fsetprecision","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fschlopp96%2Fsetprecision/lists"}