Round
Rounds a number to a fixed number of decimal places. Folded at compile time: the result is spliced into the surrounding text as characters, so no node reaches the renderer and the number cannot be re-formatted, animated or bound to afterwards. Rounding is half away from zero.
Explained in:Value primitives
#Attributes
#Allowed content
Body { }A number
#Examples
The correlation settles at !round:2{0.8734}.!round{3.7}#Notes
!round:2{3.14159}folds to3.14;!round{3.7}to4;!round:2{3.1}to3.1— a result renders as the shortest exact decimal, with no trailing zeros.- A fold cannot read a live value:
!round:2{#f.slope}is a compile error, because a binding has no value until the document renders. Round a live number with!value's owndigitsinstead.