Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 673 Bytes

File metadata and controls

26 lines (18 loc) · 673 Bytes

zig_decimal

zig_decimal is a standalone Zig decimal arithmetic package extracted from Forge's Zig execution kernel.

It provides:

  • fixed-scale decimal arithmetic with up to 28 decimal places
  • fromF64 conversion tuned to match rust_decimal-style semantics
  • rounding, normalization, division, square root, logarithm, exponentiation, and power helpers
  • a small, importable Zig package surface via @import("zig_decimal")

Quick start:

const dec = @import("zig_decimal");

const price = dec.Decimal.fromF64(76.51) orelse unreachable;
const qty = dec.Decimal.fromInt(700);
const turnover = price.mul(qty);

Run tests with:

zig build test