Transform - Numbers: Round

The Round template appears in the template list when a numeric field of type float32, float64, int8, int16, int32, int64uint8, uint16, uint32, or uint6, has been picked in the Transform pane.  The template computes various rounding operations.

 

Round

Rounding operations.   Save the result into the specified Result destination using the specified numeric type.  The Round to box allows choosing the decimal position for rounding, for example, rounding to decimal fractions like 0.001 or rounding to whole decimal positions like 10000.

 

  • down (floor) - Round down to the next lowest Round to position value. 400.7 would round down to 400.   -400.7 would round down to -401 (which is a smaller amount, and thus "down," from 400).
  • to nearest (round) - Round up or down to the nearest Round to position value. When rounding to 1, a value of 400.5 or greater fraction will get rounded up to 401 while fractional parts less than .5 will get rounded down to 400.
  • to zero (trunc) - Rounding towards zero: Equivalent to rounding down for positive numbers, and rounding up for negative numbers.
  • up (ceil) - Round up to the next highest Round to position value. 400.2 would round up to 401.   -400.2 would round up to -400 (which is a large amount, and thus "up," from 400).

 

Launch the template by choosing a numeric field and then double-clicking the Round template.   When the template launches we can specify options.

 

 

Round : down (floor)

Round down to the next lowest Round to position value. 400.7 would round down to 400.   -400.7 would round down to -401 (which is a smaller amount, and thus "down," from 400).

 

We start with a table that has two fields, both of which are float64 data type.  We will put the results of our rounding operation into the Rounded result field.

 

 

With the focus on the table window, in the Transform pane we choose the Fractions field, and then we double-click the Round template to launch it.

 

 

In the Round template we choose down (floor) as the Use option.   From the pull down menu we choose 1 (the default) for the Round to value.

 

In the Result box we choose the Rounded result field.  If we prefer, we could choose Same Field to round the Fractions field "in place", or we could choose New Field to create a new field for the result.

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded down to a whole integer value.   

 

If we wanted to round down to a given number of decimal places, either before or after the decimal point, we can choose different values as desired for the Round to parameter.  

 

 

For example, we can re-run the transform choosing 0.01 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded down to two decimal positions to the right of the decimal point.

 

We can also round down to decimal positions to the left of the decimal point.

 

 

We re-run the transform choosing 10 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded down to one decimal position to the left of the decimal point.

 

Round : to nearest (round)

Round up or down to the nearest Round to position value. When rounding to 1, a value of 400.5 or greater fraction will get rounded up to 401 while fractional parts less than .5 will get rounded down to 400.

 

We start with a table that has two fields, both of which are float64 data type.  We will put the results of our rounding operation into the Rounded result field.

 

 

With the focus on the table window, in the Transform pane we choose the Fractions field, and then we double-click the Round template to launch it.

 

 

In the Round template we choose to nearest (round) as the Use option.   From the pull down menu we choose 1 (the default) for the Round to value.

 

In the Result box we choose the Rounded result field.  If we prefer, we could choose Same Field to round the Fractions field "in place", or we could choose New Field to create a new field for the result.

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up or down to the nearest whole integer value.   

 

If we wanted to round up or down to the nearest given number of decimal places, either before or after the decimal point, we can choose different values as desired for the Round to parameter.  

 

 

For example, we can re-run the transform choosing 0.01 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up or down to the nearest two decimal positions to the right of the decimal point.

 

We can also round to the nearest decimal positions to the left of the decimal point.

 

 

We re-run the transform choosing 10 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up or down to the nearest single decimal position to the left of the decimal point.

 

See an example in the Transform - Numbers: Copy topic.

 

Round : to zero (trunc)

Rounding towards zero: Equivalent to rounding down for positive numbers, and rounding up for negative numbers.

 

We start with a table that has two fields, both of which are float64 data type.  We will put the results of our rounding operation into the Rounded result field.

 

 

With the focus on the table window, in the Transform pane we choose the Fractions field, and then we double-click the Round template to launch it.

 

 

In the Round template we choose to zero (trunc) as the Use option.   From the pull down menu we choose 1 (the default) for the Round to value.

 

In the Result box we choose the Rounded result field.  If we prefer, we could choose Same Field to round the Fractions field "in place", or we could choose New Field to create a new field for the result.

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded toward zero to a whole integer value.   The result is often called a truncation since it takes the whole integer part of the number, discarding any decimal fractional part.

 

If we wanted to round toward zero to a given number of decimal places, either before or after the decimal point, we can choose different values as desired for the Round to parameter.  

 

 

For example, we can re-run the transform choosing 0.01 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded toward zero to two decimal positions to the right of the decimal point.

 

We can also round toward zero to decimal positions to the left of the decimal point.

 

 

We re-run the transform choosing 10 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded toward zero to one decimal position to the left of the decimal point.

 

Round : up (ceil)

Round up to the next highest Round to position value. 400.2 would round up to 401.   -400.2 would round up to -400 (which is a large amount, and thus "up," from 400).

 

We start with a table that has two fields, both of which are float64 data type.  We will put the results of our rounding operation into the Rounded result field.

 

 

With the focus on the table window, in the Transform pane we choose the Fractions field, and then we double-click the Round template to launch it.

 

 

In the Round template we choose up (ceil) as the Use option.   From the pull down menu we choose 1 (the default) for the Round to value.

 

In the Result box we choose the Rounded result field.  If we prefer, we could choose Same Field to round the Fractions field "in place", or we could choose New Field to create a new field for the result.

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up to a whole integer value.   

 

If we wanted to round up to a given number of decimal places, either before or after the decimal point, we can choose different values as desired for the Round to parameter.  

 

 

For example, we can re-run the transform choosing 0.01 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up to two decimal positions to the right of the decimal point.

 

We can also round up to decimal positions to the left of the decimal point.

 

 

We re-run the transform choosing 10 for the Round to value.  

 

Press Transform.

 

 

The template populates the Rounded result field with values from the Fractions field that have been rounded up to one decimal position to the left of the decimal point.

 

 

See Also

Transform Pane

 

Transform Reference

 

Transform - Expression

 

Transform - Numeric Vectors

 

Transform - Numbers

 

Transform - Numbers: Arithmetic

 

Transform - Numbers: Bit Logic

 

Transform - Numbers: Copy

 

Transform - Numbers: Expression

 

Transform - Numbers: Hyperbolic

 

Transform - Numbers: Limit

 

Transform - Numbers: Random

 

Transform - Numbers: Special

 

Transform - Numbers: Trigonometric