Skip to content
@teakit/arith documentation

Decimal addition

Add decimal quantities while preserving their input precision.

Example

Pass decimal strings directly to Arith.from. Converting a value to a JavaScript number first can lose digits before Arith receives it.

ts
import { Arith } from "@teakit/arith";

const subtotal = Arith.from("0.1");
const total = subtotal.add("0.2");
total.toString(); // "0.3"

Keep intermediate results as Arith values. Convert the final result to a string when you need decimal text for display or storage.