maba/math
Composer 安装命令:
composer require maba/math
包简介
PHP library for arbitrary precision mathematics
关键字:
README 文档
README
PHP library for arbitrary precision mathematics.
Installation
composer require maba/math
Why
var_dump(intval(9223372036854775807 + 1)); // int(-9223372036854775808) var_dump(5.2 * 3 === 15.6); // bool(false) var_dump((8 + 92233720368547750) * 1500 / 1500 - 92233720368547750); // float(16)
Usage
use Maba\Component\Math\BcMath; use Maba\Component\Math\Math; use Maba\Component\Math\NumberFormatter; $basicMathImplementation = new BcMath(); $math = new Math($basicMathImplementation); var_dump($math->add('9223372036854775807', '1')); // string(40) "9223372036854775808.00000000000000000000" var_dump($math->isEqual($math->mul('5.2', '3'), '15.6')); // bool(true) var_dump($math->sub($math->div($math->mul($math->add('8', '92233720368547750'), '1500'), '1500'), '92233720368547750')); // string(22) "8.00000000000000000000" $result = $math->pow($math->mul('3.141592653589793', '2.71828182845904523536'), 13); $formatter = new NumberFormatter($math); echo $formatter->formatNumber($result, 4, '.', ' '); // prints 1 284 625 710 591.2256
BcMath class uses bcmath functions. If you need to use some other arbitrary precision math implementation,
implement BasicMathInterface.
Running tests
composer install vendor/bin/phpunit
maba/math 适用场景与选型建议
maba/math 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72.16k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2014 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「math」 「bcmath」 「mathematics」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 maba/math 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maba/math 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 maba/math 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Fork of krowinski/bcmath-extended with added nullable input arguments
LaTeX formula to PNG
Mathematical functions with strict typing and predictable error handling
A package for working with arbitrary precision numbers in Laravel.
Geo calculations library
Partition problem for balanced arrays splitting made easy.
统计信息
- 总下载量: 72.16k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 29
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-09-20