OTX Reference  
OpenTestSystem.Otx.Core.Terms.RoundToNearest Class Reference

Gets the rounded to the nearest integer value of the operand. More...

Inheritance diagram for OpenTestSystem.Otx.Core.Terms.RoundToNearest:
Inheritance graph

Public Attributes

NumericTerm numeral
 The numeric term that shall be rounded to the nearest integer. If there are two nearest integers, the term shall be rounded to the nearest integer towards plus infinity for positive numbers and rounded to the nearest integer towards minus infinity for negative numbers. More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Terms.Term
MetaData metaData
 Cardinality [0..1]
The MetaData type allows tools to store additional, mainly tool-specific data. More...
 

Detailed Description

Gets the rounded to the nearest integer value of the operand.

RoundToNearest is an IntegerTerm which returns the rounded to the nearest integer value of the operand. In case the range of the Integer type is exceeded through the rounding operation or NaN, -INF or INF, the behaviour is tool specific.

Syntax
IntegerTerm = RoundToNearest(NumericTerm);
Examples
// Local Declarations
Integer Result1;
// Flow
// Below expression should return 0
Result1 = RoundToNearest(-0.0);
// Below expression should return 1
Result1 = RoundToNearest(0.5);
// Below expression should return -2
Result1 = RoundToNearest(-1.5);
// Below expression should return 2
Result1 = RoundToNearest(1.546);

Member Data Documentation

◆ numeral

NumericTerm OpenTestSystem.Otx.Core.Terms.RoundToNearest.numeral

The numeric term that shall be rounded to the nearest integer. If there are two nearest integers, the term shall be rounded to the nearest integer towards plus infinity for positive numbers and rounded to the nearest integer towards minus infinity for negative numbers.