alxdeex / math
v2.0.0
2020-10-09 07:54 UTC
Requires
- php: >=7.4
- phospr/fraction: dev-master
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-09 16:32:28 UTC
README
任务
需要编写一个处理复数的类,实现加法、减法、乘法和除法操作,并测试其功能。
附加任务
假设在使用过程中需要扩展功能,以三角函数形式表示复数。客户端在进行复数运算时可以使用代数形式或三角形式,而无需知道实际使用的是哪种形式。请在您的仓库中添加相应的修改。
用法
$ composer require alxdeex\math
use alxdeex\Math\Complex; $a = Complex::algebraic(1, 2); $b = Complex::algebraic(0, 5); $c = $a->add($b); echo "$a; $b; $c";
对于开发者
- 安装 phpunit
$ docker run --rm --interactive --tty --volume $PWD:/app composer install
- 运行测试
$ docker run --rm --tty --volume $PWD:/math php /math/vendor/bin/phpunit /math/tests