Rounding
apama.analyticskit.blocks.core.Rounding
Rounds the input to a specified number of decimal points or to an integer, using a selectable rule.
Rounding a numerical value means replacing it by another value that is approximately equal but has a shorter and simpler representation.
The rules available for use are:
Up (or take the ceiling, or round towards plus infinity) rounds the input up to the nearest target number.
Down (or take the floor, or round towards minus infinity) rounds the input down to the nearest target number.
Towards Zero (or truncate, or round away from infinity) rounds the input towards zero to the nearest target number.
Nearest (or round half up, or round half towards positive infinity) rounds to the nearest target number. Numbers that are equidistant from the two nearest target numbers are always rounded up. For example, value
23.5 gets rounded to
24, but
-23.5 gets rounded to
-23.Even or Nearest rounds to the nearest target number. Numbers that are equidistant from the two nearest target numbers are always rounded to the nearest even target. For example,
0.5 rounds down to
0 and
1.5 rounds up to
2. Also known as Bankers Rounding.
The value is rounded to the nearest 'target number' - this is a whole number (if the number of decimal points is zero), or rounded to the number of decimal points specified. If the number of decimal points is negative, it is rounded to a power of 10. For example, if the number of decimal points is 2, it is rounded to the nearest 0.01 (that is, hundredths). If the number of decimal points is -3, it is rounded to the nearest 1000 (that is, thousands).
Parameters
Name | Description | Type | Notes |
Rule | The rounding rule to be applied. | Option - one of: Up Down Towards Zero Nearest Even or Nearest | |
Number of Decimal Points | The number of decimal points the input is to be rounded to. | integer | Default: 0 |
Input Port Details
Name | Description | Type |
Value | The input value which is to be rounded. | float |
Output Port Details
Name | Description | Type |
Rounded Value | The input value rounded to a specified number of decimal points or to an integer. | float |