Meanders.Tools
Meanders · Utilities

ME Round Number

ME Round · v0.1.0

Round numbers to a specified number of decimal places.

Overview

Description

Rounds one or more numbers to a specified number of decimal places. Values exactly halfway between two results are rounded away from zero.

Input Parameters

Inputs

2 parameters

Number

N

Numbers to round.

numberlist

Decimal Places

Doptional

Number of decimal places to keep.

integeritem
Output Parameters

Outputs

1 parameter

Rounded

R

Rounded numbers.

numberlist
Usage

Examples

Round to two decimal places

Round a number to two decimal places.

Input
12.34567 with D = 2
Output
12.35

Round multiple numbers

Round a list of numbers using the same decimal-place setting.

Input
[12.345, 8.999, 3.14159] with D = 2
Output
[12.35, 9.00, 3.14]

Halfway values

Values exactly halfway between two results are rounded away from zero.

Input
1.125 with D = 2
Output
1.13
Additional Information

Notes

  • Decimal Places defaults to 2.
  • Decimal Places must be an integer between 0 and 15.
  • Rounding uses MidpointRounding.AwayFromZero.
  • The Number input accepts a list of numbers.
Validation

Errors

  • !Decimal Places cannot be negative.
  • !Decimal Places must be between 0 and 15.
  • !Number cannot contain NaN or Infinity.
Explore More

Related Components