Download the PHP package trademinator/bcmath without Composer
On this page you can find all versions of the php package trademinator/bcmath. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download trademinator/bcmath
More information about trademinator/bcmath
Files in trademinator/bcmath
Package bcmath
Short Description Framework-agnostic BCMath helpers and precision utilities for PHP.
License MIT
Informations about the package bcmath
trademinator/bcmath
Framework-agnostic BCMath helpers and reusable precision utilities for PHP.
The package has no Laravel dependency. Laravel applications may construct a PrecisionPolicy from their own configuration, while standalone PHP applications can instantiate the same objects directly.
Requirements
- PHP 8.2+
ext-bcmath
Installation
Once the repository/package is published:
Public functions
Decimal precision
bcdec() returns the exact largest represented decimal count. It does not impose a minimum scale.
Scientific notation is expanded first, without converting string input to float:
PrecisionPolicy and PrecisionContext
Resolve precision once for a price/data slice, then pass the resolved scale through hot-path calculations instead of repeatedly recalculating decimal precision.
Default policy:
- minimum scale:
16 - guard digits:
4 - maximum scale:
32 - trailing zero trimming when resolving context: enabled
Standard deviation
The old Trademinator helper name stats_standard_deviation() is replaced by the BCMath-style bcstddev():
Logarithm
bclog10() returns a decimal string. It does not convert decimal string input to float.
Intentional package boundary
technical_scale() is not part of this package. It belongs to the Trademinator Technical layer because it is technical-indicator precision policy, not a missing generic BCMath primitive.
Likewise, this package contains no EXCHANGE_ROUND_DECIMALS constant and no framework configuration lookup. Precision is explicit through PrecisionPolicy, PrecisionContext, or a function's scale argument.
Laravel
No service provider is required. Use the package exactly as in plain PHP. If Laravel configuration should control precision, translate that configuration into a PrecisionPolicy in the application layer and pass the resolved context explicitly.
License
MIT
All versions of bcmath with dependencies
ext-bcmath Version *