Round
This reference collection includes Vector documentation reproduced with permission. Snippets may require configuration-specific symbols and are not all standalone programs. Sources and validation limits.
Syntax
long _round(double x);
int64 _round64(double x);
Function
Rounds x to the nearest integral number. The rounding method used is symmetric arithmetic rounding.
Parameters
x Number to be rounded
Return Values
Nearest integral number. For very large numbers, you should use _round64, which returns a 64 bit integer.
Reference example from the CANoe 12 help. Check the required configuration, database objects and API availability in your installed version; this is not a recorded compiler or runtime test.
long result;
result = _round(2.4); // result == 2
result = _round(2.5); // result == 3
result = _round(-3.5); // result == -4