A custom Contact Form 7 lead adapter may need to preserve an estimated budget, compare a quantity with a business threshold or calculate a normalized amount. Choosing a decimal library becomes useful when the workflow performs arithmetic that must follow explicit precision rules. It does not replace input validation or the receiving API’s schema.

This comparison covers decimal.js, big.js, Python decimal, Brick Math and shopspring/decimal. They are developer components for different runtimes, not installable CF7 connectors. Official documentation and license sources were reviewed October 30, 2026. The evaluation suggestions are proposed checks; no firsthand benchmark or production integration is claimed.
Start with the amount contract
Our decimal amount mapping guide explains why the entry format, machine representation and display format need separate decisions. Before selecting a library, state the accepted input grammar, unit, range, rounding boundary and destination type. If the workflow simply forwards a validated decimal string unchanged, arithmetic machinery may be unnecessary.
Keep the calculation where its owner can maintain it. A WordPress-side adapter, a Python worker and a Go service have different deployment contexts. Rewriting the integration into another language merely to adopt a library can add more operational risk than the arithmetic component removes. Evaluate error handling and serialization with the same care as addition.
| Product | Runtime and fit | Main decision boundary | Core license and cost |
|---|---|---|---|
| decimal.js | JavaScript with a broad decimal API | Significant-digit precision and rounding configuration | MIT; no core license charge |
| big.js | JavaScript with a focused arithmetic surface | Division precision, strict construction and output | MIT; no core license charge |
| Python decimal | Python standard-library workers | Context precision, signals and quantization | Python distribution license terms |
| Brick Math | PHP server-side adapters | Explicit scale and rounding for BigDecimal division | MIT; no core license charge |
| shopspring/decimal | Go services with decimal records | Division and JSON/SQL representation policy | MIT; no core license charge |
decimal.js
decimal.js provides an arbitrary-precision decimal type with configurable precision and rounding. Its API covers a broad range of mathematical operations. That breadth can fit an established JavaScript calculation layer, especially when the workflow needs more than a narrow budget comparison. It remains your application’s responsibility to reject input formats that the business contract does not allow.
Strength: one documented decimal API for a JavaScript adapter with varied calculation needs. Limitation: a significant-digit precision setting is not the same as a fixed number of fractional places. A developer needs to understand the rounding context and the output method selected for the CRM field. Broad mathematical capability does not imply unlimited exactness in every operation.
For evaluation, start from a validated decimal string and inspect the serialized result. Include a long whole-number part with a short fractional part, since an apparently generous precision setting can still have consequences at different magnitudes. Keep the chosen configuration explicit near the calculation boundary rather than letting unrelated code change a shared default. The official repository identifies the MIT license; implementation and upkeep still require engineering time.
big.js
big.js offers a smaller conceptual surface for JavaScript decimal arithmetic. Its documented controls include decimal places and rounding mode for division-related operations, along with strict construction that can reject primitive number input. This can suit an adapter whose arithmetic requirements are deliberately limited and whose input policy favors strings.
Strength: a focused API that can be straightforward to review for a small mapping task. Limitation: fewer mathematical features than a broader library, and configuration whose meaning must be read rather than assumed to match another package. A team moving between decimal.js and big.js should not copy precision settings by name and expect identical semantics.
Evaluate addition, division and conversion to the destination representation separately. Include a decimal that cannot be represented exactly as a binary number, and ensure the workflow does not first convert the original string into a primitive number. Strict construction can help enforce that boundary, but it cannot recover digits lost earlier. The official repository and license establish MIT terms. No performance ranking is inferred from the project’s own size or speed descriptions.
Python decimal
Python decimal is available in the standard library. It supports decimal values, arithmetic contexts, rounding modes and signals. Quantization gives a way to apply a chosen exponent and rounding policy at a defined boundary. It is a natural candidate when an existing Python worker already validates and transforms lead data.
Strength: a maintained standard-library component with explicit arithmetic controls. Limitation: context settings and conversion choices require care. Constructing a Decimal from a binary float preserves information about that float; it does not restore an original decimal string that was discarded. A worker still needs a deliberate JSON encoder or field representation for the receiving API.
Use a local calculation context where appropriate so that one task’s precision policy does not accidentally govern unrelated work. Include a rounding-boundary fixture and an invalid input fixture in the review. Decide how exceptional conditions become a held inquiry or a clear validation result. Python’s distribution license documentation supplies the relevant terms; the module is not a separately priced SaaS plan, and hosting remains a separate cost.
Brick Math
Brick Math provides arbitrary-precision integer, decimal and rational classes for PHP. BigDecimal is the relevant starting point for a decimal lead amount. Its documented division API requires a scale, with a rounding mode when the exact result does not fit that scale. That makes a business decision visible at a calculation boundary that might otherwise be implicit.
Strength: a PHP-oriented component that can fit the same server-side codebase as a maintained WordPress adapter. Limitation: dependency compatibility and exception handling still need deliberate integration. The library’s ability to represent a large number does not mean the CRM’s field can accept that range or precision.
Keep the source amount as a reviewed string and choose the appropriate class deliberately. A rational intermediate may suit one calculation, but the destination still needs a finite representation and rounding rule. In evaluation, verify that an operation requiring rounding produces the planned result or the intended exception. The MIT license does not impose a core subscription charge. Verify the selected package release’s PHP requirements against the actual worker before installation.
shopspring/decimal
shopspring/decimal supplies an arbitrary-precision fixed-point decimal type for Go, with documented database and JSON serialization support. It is relevant when lead transformation already runs in a Go service. The package supports several ways to control division and formatted output, so those choices should be part of the adapter contract.
Strength: decimal values that can travel through a Go worker’s arithmetic and persistence layers. Limitation: serialization defaults and package-level settings can affect the representation seen elsewhere. Read the exact release documentation before changing global controls, especially in a concurrent service. Displaying an amount without trailing zeros may be acceptable for one field and unsuitable for another.
Evaluate the full database and API round trip. Check whether JSON uses a quoted decimal or a numeric token, what the receiving schema permits, and how a fixed-scale display is produced. Prefer a scoped field representation when only one business field needs special formatting. The license is MIT. No native CF7 integration or claim of faster processing follows from choosing this package.
Choose by runtime, policy and recovery
Shortlist decimal.js for a broader JavaScript calculation layer, big.js for a deliberately focused JavaScript adapter, Python decimal for an existing Python worker, Brick Math for PHP and shopspring/decimal for Go. These are fit-based starting points. Validate the chosen release and error behavior before adding it to a production dependency tree.
Use one synthetic amount set across the review: a trailing-zero value, an accepted fraction, excess precision, an out-of-range amount, a blank and malformed input. Inspect arithmetic, storage and outbound serialization. Define what happens when a value cannot be represented under the destination’s contract; silently substituting zero is an avoidable loss of meaning.
We publish CF7 Analytics and develop Svetlik Analytics for Contact Form 7. The free plugin’s documented submission statistics do not provide these arithmetic adapters or analyze arbitrary budgets. Keep submission reporting separate from the connector’s amount records and the team’s business interpretation.
Sources
Official APIs, repositories and license pages are linked in each product section, reviewed October 30, 2026. Core license availability is distinct from maintenance, hosting and support costs. No paid service plans, speed benchmarks, native integrations or financial outcomes are asserted.
