Skip to main content

Round To Decimal Place(s)

Returns the rounded value of the first input with a specified number of decimal points.

Round To Decimal Place(s) block

Description

The Round To Decimal Place(s) block returns the rounded value of the first input with a specified number of decimal points. This is a code block part of the Math drawer.

Usage

Returns the rounded value of the first input with a specified number of decimal points.

Syntax

Inputs in this block:

  • First input: a number, to be rounded
  • Second input: a number, the number of decimal places to be rounded to

Example

In this model, a new random decimal is produced whenever the "Generate Decimal" button is pushed, and that decimal is then rounded to three decimal points whenever the "Round Decimal" button is pushed. This feature is often useful in making data easier to display.

Round To Decimal Place(s) example code

Notes

This feature is often useful in making data easier to display by limiting the number of decimal places shown.