{"id":21618640,"url":"https://github.com/hpez/phpbignum","last_synced_at":"2025-04-11T08:41:33.440Z","repository":{"id":56566210,"uuid":"161069398","full_name":"hpez/PHPBignum","owner":"hpez","description":"A bignum library for PHP","archived":false,"fork":false,"pushed_at":"2024-04-12T14:04:56.000Z","size":128,"stargazers_count":7,"open_issues_count":2,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T06:11:54.436Z","etag":null,"topics":["bignum","bignumber","hacktoberfest","php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/hpez.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-09T18:34:22.000Z","updated_at":"2023-08-31T05:18:46.000Z","dependencies_parsed_at":"2022-08-15T21:00:58.968Z","dependency_job_id":null,"html_url":"https://github.com/hpez/PHPBignum","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/hpez%2FPHPBignum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpez%2FPHPBignum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpez%2FPHPBignum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hpez%2FPHPBignum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hpez","download_url":"https://codeload.github.com/hpez/PHPBignum/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248362398,"owners_count":21091117,"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":["bignum","bignumber","hacktoberfest","php","php-library"],"created_at":"2024-11-24T23:06:18.375Z","updated_at":"2025-04-11T08:41:33.417Z","avatar_url":"https://github.com/hpez.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHPBignum [![Build Status](https://travis-ci.org/hpez/PHPBignum.svg?branch=master)](https://travis-ci.org/hpez/PHPBignum) [![codecov](https://codecov.io/gh/hpez/PHPBignum/branch/master/graph/badge.svg)](https://codecov.io/gh/hpez/PHPBignum) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/fb8fecb2617a41e9a05ee90e24d42e04)](https://app.codacy.com/app/hpez/PHPBignum?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=hpez/PHPBignum\u0026utm_campaign=Badge_Grade_Dashboard)\n\nA bignum library for PHP.\n\n| Type          | Addition      | Subtraction   | Division      | Multiplication | Square root    | Power          |\n| ------------- |---------------|---------------|---------------|----------------|----------------|----------------|\n| BigInt        | done          | done          | done          | done           | done           | done           |\n| BigFloat      | done          | done          | done          | done           | done           | done        |\n\n## Setting up for developers\nJust clone the project, go to the project directory and run `composer install` and should be good to go! Oh and also for running tests you should do `vendor/phpunit/phpunit/phpunit tests/`.\n\n## Installation\nThe package is installable via `composer require hpez/php-bignum` or [packagist repo](https://packagist.org/packages/hpez/php-bignum)\n\n## Usage\n```php\n\u003c?php\n\n// BigInteger Addition\n$bigInt1 = new BigInt('123456')\n$bigInt2 = new BigInt('654321');\n$bigInt1-\u003eadd($bigInt2);\necho $bigInt1; // \"777777\"\n\n// BigFloat Addition\n$bigFloat1 = new BigFloat('123456.111');\n$bigFloat2 = new BigFloat('654321.22');\n$bigFloat1-\u003eadd($bigFloat2)\necho $bigFloat1; // \"777777.331\"\n\n// BigInteger Subtraction\n$bigInt3 = new BigInt('777777');\n$bigInt4 = new BigInt('654321');\n$bigInt3-\u003esub($bigInt4);\necho $bigInt3; // \"123456\"\n\n// BigFloat Subtraction\n$bigFloat3 = new BigFloat('123456.111');\n$bigFloat4 = new BigFloat('654321.22');\n$bigFloat3-\u003esub($bigFloat4);\necho $bigFloat3; // results \"530865.109\"\n\n// BigInteger Division\n$bigInt5 = new BigInt('777777');\n$bigInt6 = new BigInt('654321');\n$bigInt5-\u003ediv($bigInt6);\necho $bigInt5; // \"1\"\n\n// BigFloat Division\n$bigFloat5 = new BigFloat('123456.111');\n$bigFloat6 = new BigFloat('654321.22');\n$bigFloat5-\u003ediv($bigFloat6);\necho $bigFloat5; // \"0.188678\"\n\n// BigInteger Multiplication\n$bigInt7 = new BigInt('777777');\n$bigInt8 = new BigInt('654321');\n$bigInt7-\u003emultiply($bigInt8);\necho $bigInt7; // \"508915824417\"\n\n// BigFloat Multiplication\n$bigFloat7 = new BigFloat('123456.111');\n$bigFloat8 = new BigFloat('654321.22');\n$bigFloat7-\u003emultiply($bigFloat8);\necho $bigFloat7; // \"80779953165.97542\"\n\n// BigInteger Modulo\n$bigInt9 = new BigInt('777777');\n$bigInt10 = new BigInt('654321');\n$bigInt9-\u003emod($bigInt10);\necho $bigInt9; // \"123456\"\n\n// BigInteger Power\n$bigInt11 = new BigInt('777777');\n$bigInt12 = new BigInt('1');\n$bigInt11-\u003epow($bigInt12);\necho $bigInt11; // \"777777\"\n\n// BigFloat Power\n$bigFloat9 = new BigFloat('12345.12345');\n$bigInt13 = new BigInt('3');\n$bigFloat9-\u003epow($bigInt13);\necho $bigFloat9 // \"1881422405168.320420453463625\"\n\n// BigInteger Square Root\n$bigInt14 = new BigInt('10000');\n$bigInt15-\u003esqrt();\necho $bigInt14; // \"100\"\n\n// BigFloat Square Root\n$bigFloat10 = new BigFloat('2');\n$bigFloat11-\u003esqrt(7);\necho $bigFloat10; // \"1.4142136\"\n\n// BigInteger Lesser-Than\n$bigInt16 = new BigInt('1234567890');\n$bigInt17 = new BigInt('1234567891');\necho $bigInt16-\u003eisLesserThan($bigInt17); // True\n\n$bigInt18 = new BigInt('1234567891');\n$bigInt19 = new BigInt('1234567891');\necho $bigInt18-\u003eisLesserThan($bigInt19); // False\n\n// BigInteger Bigger-Than\n$bigInt20 = new BigInt('1234567891');\n$bigInt21 = new BigInt('1234567890');\necho $bigInt20-\u003eisBiggerThan($bigInt21); // True\n\n$bigInt22 = new BigInt('1234567891');\n$bigInt23 = new BigInt('1234567891');\necho $bigInt22-\u003eisBiggerThan($bigInt23); // False\n\n```\n\n## Roadmap\nThe goal of this project is making a complete Bignum library for PHP language, so operations other than the ones mentioned in the table should be added too (trigonometric functions, ...).\n\n## Contribution\nAny contribution in the form of an issue or a pull request is more than welcome! Also if you have any questions, feel free to create a new issue or comment on existing ones.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpez%2Fphpbignum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhpez%2Fphpbignum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhpez%2Fphpbignum/lists"}