Skip to main content
Open topic with navigation CAPL Functions » General » Function Overview » _round

_round

Valid for: CANoe DE • CANoe:lite DE • CANoe4SW DE • CANoe4SW:lite DE

Function Syntax

long _round(double x); // form 1
int64 _round64(double x); // from 2

Description

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.

Example

long result;
result = _round(2.4); // result == 2
result = _round(2.5); // result == 3
result = _round(-3.5); // result == -4