
Product
Introducing Reachability for PHP
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.
@bignum/template-light
Advanced tools
Write formulas with template literals. (light version)
This is the light version of @bignum/template. It has significantly more limited functionality than @bignum/template, but is much smaller.
f`${0.3} - ${0.1}` is easier to read than a statement like new MyNum(0.3).minus(0.1).)Note that although no rounding is performed during calculations, the calculation results are returned to
Number, so values that cannot be held byNumbermay be rounded.If you want more operations and more rounding avoidance, consider using @bignum/template.
npm install @bignum/template-light
import { f } from "@bignum/template-light";
const result = f`${0.1} + ${0.1} * ${2}`;
console.log(result); // 0.3
// Prevent rounding errors by calculating with rational numbers using BigInt.
console.log(f`${0.2} + ${0.1}`); // 0.3
console.log(0.2 + 0.1); // 0.30000000000000004
Perform calculations using template literals.
Example:
import { f } from "@bignum/template-light";
console.log(f`${0.1} + ${0.2}`); // 0.3
Repeated evaluation from the same tagged template callsite reuses the compiled expression. Different callsites are cached independently.
The following operators are supported:
/* Arithmetic Operators */
// add
f`${0.1} + ${0.2}`; // 0.3
// subtract
f`${0.3} - ${0.1}`; // 0.2
// multiply
f`${0.07} * ${100}`; // 7
// divide
f`${0.6} / ${0.2}`; // 3
// modulo
f`${0.6} % ${0.2}`; // 0
/* Parentheses */
f`(${0.1} + ${0.2}) * ${10}`; // 3
f`${0.1} + ${0.2} * ${10}`; // 2.1
Substitutions in the template literal are treated as operands.
f`${0.2} + ${0.1}`; // 0.3
FAQs
Write formulas with template literals.
We found that @bignum/template-light demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Reachability analysis for PHP is now available in experimental, helping teams identify which vulnerabilities are actually exploitable.

Product
Export Socket alert data to your own cloud storage in JSON, CSV, or Parquet, with flexible snapshot or incremental delivery.

Research
/Security News
Bitwarden CLI 2026.4.0 was compromised in the Checkmarx supply chain campaign after attackers abused a GitHub Action in Bitwarden’s CI/CD pipeline.