Bcmath
Object wrapper for PHP BcMath Library
Install / Use
/learn @dbojdo/BcmathREADME
Object wrapper for PHP BcMath Library
This library provides immutable representation of BcMath number supporting all BcMath extension operations (see http://php.net/manual/en/book.bc.php)
Installation
Composer: add the webit/bcmath into composer.json
{
"require": {
"php": ">=7.1.0",
"webit/bcmath": "^2.0.0"
}
}
Usage
$num = new BcMathNumber('123.1233');
$result = $num->add('13.22')->mul('3.05');
echo $result . "\n";
Release note
This version 2.0 breaks a backward compatibility. Since now BcMathNumber:
- is marked
final - constants are marked
private - works only for PHP >= 7.1
Version 1.1 breaks a backward compatibility. Since now BcMathNumber:
- is immutable (removed setValue method)
- has no instance property scale (removed instance methods getScale / setScale) as number itself can't have a scale
To use previous version see tag 1.0.0 https://github.com/dbojdo/bcmath/tree/1.0.0
Tests
docker-compose run --rm src composer install
docker-compose run --rm phpunit
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
