resolution

Smallest non-zero gap between unique numeric values in values.

With zero: true (the default) the value 0 is added to values before the calculation, so the resolution also accounts for the distance to zero. This is the convention adopted throughout Gribouille for positional adjustments.

Returns 1 when values has fewer than two distinct numeric entries.

Usage

resolution(
  values,
  zero: true,
)

Parameters

Parameter Default Description
values Array of numbers; non-numeric and none entries are dropped.
zero true Whether to include zero when computing the resolution.

Returns

The smallest positive difference between consecutive unique values, or 1 when no such difference exists.

Examples

Default behaviour folds in zero so the result reflects the smallest distinct increment from the origin too.

#let r = resolution((1, 2, 4, 7))
// r == 1.0

Pass zero: false when the data does not naturally include zero and you only want gaps between observed values.

#let r = resolution((10, 12, 16, 22), zero: false)
// r == 2.0
Back to top