{"id":19956091,"url":"https://github.com/krowinski/bcmath-extended","last_synced_at":"2025-04-06T20:13:01.737Z","repository":{"id":50132089,"uuid":"54338707","full_name":"krowinski/bcmath-extended","owner":"krowinski","description":"Extends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers. Also wraps existing BCMath functions.","archived":false,"fork":false,"pushed_at":"2023-01-25T21:38:04.000Z","size":121,"stargazers_count":76,"open_issues_count":1,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-30T18:11:15.223Z","etag":null,"topics":["abs","arbitrary-precision","bignumber","ceil","complex-numbers","composer-packages","deche","decimals","floor","math","money","php","rand","scientific-notation"],"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/krowinski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-20T20:27:51.000Z","updated_at":"2024-12-04T19:25:59.000Z","dependencies_parsed_at":"2023-02-14T11:45:49.392Z","dependency_job_id":null,"html_url":"https://github.com/krowinski/bcmath-extended","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krowinski%2Fbcmath-extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krowinski%2Fbcmath-extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krowinski%2Fbcmath-extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krowinski%2Fbcmath-extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krowinski","download_url":"https://codeload.github.com/krowinski/bcmath-extended/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247543593,"owners_count":20955865,"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":["abs","arbitrary-precision","bignumber","ceil","complex-numbers","composer-packages","deche","decimals","floor","math","money","php","rand","scientific-notation"],"created_at":"2024-11-13T01:30:01.728Z","updated_at":"2025-04-06T20:13:01.719Z","avatar_url":"https://github.com/krowinski.png","language":"PHP","readme":"# bcmath-extended\n[![PHP Tests](https://github.com/krowinski/bcmath-extended/actions/workflows/tests.yml/badge.svg)](https://github.com/krowinski/bcmath-extended/actions/workflows/tests.yml)\n[![Code Coverage](https://raw.githubusercontent.com/krowinski/bcmath-extended/master/badge-coverage.svg)](https://github.com/krowinski/bcmath-extended/actions)\n[![Latest Stable Version](https://poser.pugx.org/krowinski/bcmath-extended/v/stable)](https://packagist.org/packages/krowinski/bcmath-extended)\n[![Total Downloads](https://poser.pugx.org/krowinski/bcmath-extended/downloads)](https://packagist.org/packages/krowinski/bcmath-extended)\n[![License](https://poser.pugx.org/krowinski/bcmath-extended/license)](https://packagist.org/packages/krowinski/bcmath-extended)\n\nExtends php BCMath lib for missing functions like floor, ceil, round, abs, min, max, rand for big numbers.\nAlso wraps existing BCMath functions. (more http://php.net/manual/en/book.bc.php)\n\nInstallation\n===\n\n```sh\ncomposer require krowinski/bcmath-extended\n```\n\nFeatures\n===\n- config\n    - setTrimTrailingZeroes - disable|enable trailing zeros (default trimming is enabled)  \n- new tool methods\n    - convertScientificNotationToString - converts scientific notation to string\n    - getScale - gets current global scale \n    - getDecimalsLengthFromNumber - gets amount of decimals \n    - hexdec - converting from hexadecimal to decimal\n    - dechex - converting from decimal to hexadecimal\n    - bin2dec - converting from binary to decimal\n    - dec2bin - converting from decimal to binary\n- new math functions \n    - round\n    - abs \n    - rand\n    - max\n    - min\n    - roundDown\n    - roundUp\n    - roundHalfEven\n    - ceil\n    - exp\n    - log\n    - fact\n    - pow (supports fractional)\n    - mod (supports fractional + scale in php 5.6 \u003c)\n    - bitwise operators\n        - bitXor\n        - bitOr\n        - bitAnd\n- proxy for original functions (http://php.net/manual/en/book.bc.php)\n- all functions supports scientific notation\n- all functions are static, so it can be easily replaced by this lib\n\nInfo\n===\nAs of 7.2 float can be passed to bcmod, but they don't return correct values (IMO)\n\nI created bug for this in https://bugs.php.net/bug.php?id=76287, but it was commented as documentation issue not a bug.\n\n```\nbcmod() doesn't use floor() but rather truncates towards zero,\nwhich is also defined this way for POSIX fmod(), so that the\nresult always has the same sign as the dividend.  Therefore, this\nis not a bug, but rather a documentation issue.\n```\n\nBut I still will use floor not truncated for mod in this lib.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrowinski%2Fbcmath-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrowinski%2Fbcmath-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrowinski%2Fbcmath-extended/lists"}