robertbakker/big-calculator

该包已被弃用且不再维护。未建议替代包。

大数计算器

0.0.4 2018-11-18 10:30 UTC

This package is auto-updated.

Last update: 2022-08-18 18:42:49 UTC


README

这是一个简单的计算器,使用任意精度的大数。使用 brick/math 进行大数计算。

免责声明:与任何由计算机完成的计算一样,请始终检查它们。特别是当处理使用小数的计算时。

使用方法

use RobertBakker\BigCalculator\Calculator;

$calculator = Calculator::create();
$calculator->calculate("1.234 / 5 + 3.4"); // outputs \Brick\Math\BigDecimal

变量

// Example with 4% interest over 3 years
$calculator = Calculator::create();
$calculator->addVariable("years", 3);
$calculator->calculate("2000 * 1.04 ^ years");

开发

# For testing purposes
composer run test

# Benchmarking
composer run bench