承接 olegstan/safe-bc-math 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

olegstan/safe-bc-math

Composer 安装命令:

composer require olegstan/safe-bc-math

包简介

Safe versions of BC math functions

README 文档

README

Installation

$ composer require backendtea/safe-bc-math

Why this package

Casting a float to a string does not always do what you think it does. Some locales may give unexpected results, and give a malformed string, or the number is cast to a scientific notationm for example: 1.0E-11. Which bcmath cant handle. Even if you do not manually cast it to a string, the bc math functions expect strings, and will cast it themselves.

This package will throw an exception telling you what error it encountered, instead of giving a warning bcmath function argument is not well-formed and returning a wrong error.

Usage

Replace any usage of bc math functions with the Backendtea\bc.. version.

e.g.

- bcadd($a, $b);
+ \BackEndTea\bcadd($a, $b);

Or even better, import the funtion:

+ use function BackEndTea\bcadd;

bcadd($a, $b);

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-25