typst/typst · error

integer value is too small

Error message

integer value is too small

What it means

From overflowing_int_negation_error in the evaluator: an integer literal's positive value exceeds the signed 64-bit range when negated (a too-negative number), and the parser rejects it outright; the hints suggest a float or float-based representation that can approximately hold the magnitude.

Source

Thrown at crates/typst-eval/src/ops.rs:148

                hint: "2^63 does not fit into a signed 64-bit integer";
                hint: "try writing `int.min`";
            );
        } else {
            let mut error = error!(
                unary.span(),
                "integer value is too small";
                hint: "value does not fit into a signed 64-bit integer";
            );
            if base.is_none() {
                error.hint(
                    "a floating point number could approximately represent this value",
                );
                error.hint(eco_format!(
                    "you can use a floating point number by appending a dot: `{}.`",
                    expr.to_untyped().leaf_text()
                ));
            }
            bail!(error);
        }
    }
    Ok(())
}

View on GitHub (pinned to 35417aa769)

Solutions

  1. Use a floating point literal (e.g. `1e19`) for values beyond ±2^63
  2. Use `float(...)` conversions for large magnitude arithmetic
  3. Reconsider whether such large magnitudes are needed at all
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/typst-eval/src/ops.rs:148 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of typst/typst@35417aa769 (2026-08-17). Data as JSON: /api/errors/bfdba1d9a7f19505. Report an issue: GitHub.