openformula-kernel
openformula-kernel is a deterministic, typed Rust calculation kernel shared by
Tanu Markdown, TSQ1, and Kitu. It implements a deliberately bounded subset of
the function semantics in OpenFormula 1.4. It is not a complete formula
parser, workbook engine, or OpenFormula-conforming evaluator.
The crate owns scalar values, numeric policy, coercion, typed calculation errors, standard functions, an injectable evaluation context, and a registry that keeps standard and namespaced extension functions separate. Callers keep ownership of parsing, references, dependency graphs, persistence, and UI.
Supported standard functions
The initial 0.1.0 API provides SUM, MIN, MAX, AVERAGE, IF, ABS,
ROUND, FLOOR, CEILING, and POWER. See
docs/compatibility.md for the normative section of
OpenFormula 1.4 and every intentional difference.
use ;
let registry = standard;
let mut context = PureContext;
let result = registry.evaluate?;
assert_eq!;
# Ok::
Use FunctionRegistry::evaluate_lazy for IF so the unselected branch is
never evaluated. Extensions must use a namespace such as KITU.CLAMP; the
crate includes extensions::register_kitu_examples as a dependency-light
example.
Distribution and compatibility
- Releases use semantic versioning. A behavior change that can alter persisted
calculation results requires at least a minor version before
1.0. - Consumers pin the same Git revision until a crates.io publication policy is
adopted. Release tags use
vMAJOR.MINOR.PATCH. - The default
stdfeature only addsstd::error::Error; the calculation core works with--no-default-featuresandalloc, including WASM consumers. - The stable public
Numberwrapper hides the current binary64 representation so a later decimal implementation does not force callers to rewrite APIs.
Verification
See docs/numeric-policy.md for determinism and
rounding guarantees and docs/migration.md for consumer
adapter guidance.