WoodcoreMake the numbers vibe

Commands › Writing templates

#fmt-decimals Writing templates

Writes a number with at most so many decimals, no trailing zeros: 1.7291232 → «1.729».

#fmt-decimals(, )

Hover an argument: what it does. Hover its value: every possible value. A click keeps the bubble open.

The essentials

A template's building blockWhat Woodcore's own commands use; a report seldom needs it.
Exactly what is roundedNo floating-point artefacts: never 1.0840000000000001.
A text stays a textA material's name comes back unchanged; any other type is refused.

Arguments

ArgumentStatusWhat it does, and examples
The line's arguments
required
The number to write.
#fmt-decimals(1.7291232, 3)1.729
#fmt-decimals("C24", 3)a text, unchanged
required
The largest number of decimals.
#fmt-decimals(0.800, 3)0.8: the trailing zeros go
#fmt-decimals(438, 3)438: an integer stays whole

Lines to copy

Minimal call

#fmt-decimals(1.7291232, 3)

Examples

Example 1
#fmt-decimals(1.7291232, 3)
The page fmt-decimals produces, level 2
Example 2
#fmt-decimals(0.800, 3) -- #fmt-decimals(438, 3)
The page fmt-decimals produces, level 2

Defined in lib/number.typ:28