qubb/fixed-point-math

提供固定点数学功能

0.1.2 2016-04-04 22:38 UTC

This package is not auto-updated.

Last update: 2024-09-23 13:01:06 UTC


README

...

安装

要将固定点数学作为本地、项目级依赖项添加到您的项目中,只需在项目的 composer.json 文件中添加对 qubb/fixed-point-math 的依赖即可。以下是一个仅定义对固定点数学 0.1 依赖的最小 composer.json 文件示例

{
    "require": {
        "qubb/fixed-point-math": "0.1.*"
    }
}

使用

使用

\qubb\FixedPointMath\helpers\Rounder::ceil($value, $precision);
\qubb\FixedPointMath\helpers\Rounder::floor($value, $precision);
\qubb\FixedPointMath\helpers\Rounder::round($value, $precision);

进行数值正确舍入

$value - the string representation of the number
$precisions - the rounding precision