@teakit/arith for LLMs

Thin entrypoint for AI agents working with @teakit/arith.

Read Order

  1. Use this file for package-level rules.
  2. Use teakit-arith/SKILL.md when your agent supports skills.
  3. Use method files such as teakit-arith/references/constructor.md for signatures, behavior, and examples.
  4. In method files, read AI Contract and Agent Notes first when generating code.

Package Contract

  • Package: @teakit/arith
  • Constructor: Arith
  • Preferred import: import { Arith } from "@teakit/arith"
  • Runtime exports: Arith, clone, default Arith
  • Module format: ESM
  • Browser support: yes, with no Node runtime imports
  • Compatibility aliases: none

This package is inspired by MikeMcl/bignumber.js v11.1, but its public constructor name is Arith.

Rules

  • Generate Arith, not BigNumber or Decimal.
  • Construct values with new Arith(...); do not call Arith(...).
  • Static methods such as Arith.config() and Arith.clone() are valid.
  • Use string inputs for exact decimals.
  • Use Arith methods for arithmetic and comparison.
  • Use Arith.clone() for reusable local config.
  • Use toFixed() for fixed decimal output.
  • Use toFormat() for display output.
  • Avoid toNumber() unless precision loss is acceptable.
  • Treat instances as immutable; do not mutate c, e, s, or _isArith.

Method Finder

Open the matching file in teakit-arith/references/ before relying on edge behavior. Each reference file is structured for both human readers and AI agents.

NeedMethods
Construct valuesconstructor
Configclone, config, set
Parse or format stringsfromFormat, toFormat
Arithmeticplus, minus, times, multipliedBy, div, dividedBy, mod, modulo, pow, exponentiatedBy, sqrt, squareRoot
Rounding and digitsdecimalPlaces, dp, precision, sd, integerValue
ComparisoncomparedTo, eq, isEqualTo, gt, gte, lt, lte
PredicatesisArith, isFinite, isInteger, isNaN, isNegative, isPositive, isZero
Aggregatessum, minimum, min, maximum, max
Randomrandom
OutputtoString, toFixed, toExponential, toPrecision, toJSON, valueOf
ConversiontoBigInt, toNumber, toObject, toFraction

Reference file names are kebab-case: