Skip to content

This site describes solve-engine 2.44.0, the version npm installs.

Exact coefficients

Package: SYMBOLIC_PACKAGE. Registered by createEngine(); for a slimmer engine, register it explicitly (see choosing packages).

The numbers in front of the terms of an expression, its coefficients, are kept as exact fractions rather than the approximate floating-point numbers a computer usually uses. This is why 0.1x + 0.2x combines to exactly 0.3x here, and not the 0.30000000000000004x that ordinary floating point would give. Like the other algebra forms, this reads with a trailing arrow to show the simplified result.

A bare number is exact too: a plain 0.1 + 0.2 is exactly 0.3 (see decimals), and money keeps its decimals exact to the cent (see money precision). This page is about the coefficient, the number in front of a variable term, which stays an exact fraction all the way through the algebra.

0.1x + 0.2x => // 0.3x
x/3 + x/3 => // 2x/3

A coefficient that cannot be written as a short decimal stays a fraction rather than being rounded into one.