VF_roundVD_roundVE_round
VF_roundtoIVD_roundtoIVE_roundtoI
VF_roundtoBIVD_roundtoBIVE_roundtoBI
VF_roundtoSIVD_roundtoSIVE_roundtoSI
VF_roundtoLIVD_roundtoLIVE_roundtoLI
VF_roundtoQIVD_roundtoQIVE_roundtoQI
VF_roundtoUVD_roundtoUVE_roundtoU
VF_roundtoUBVD_roundtoUBVE_roundtoUB
VF_roundtoUSVD_roundtoUSVE_roundtoUS
VF_roundtoULVD_roundtoULVE_roundtoUL
VF_roundtoUQVD_roundtoUQVE_roundtoUQ
VF_roundtoUIVD_roundtoUIVE_roundtoUI
FunctionRounding to the nearest whole number.
Syntax C/C++#include <VFmath.h>
int VF_round( fVector Y, fVector X, ui size );
int VF_roundtoI( iVector Y, fVector X, ui size );
int VF_roundtoLI( liVector Y, fVector X, ui size );

    (similarly all other functions of this family)
C++ VecObj#include <OptiVec.h>
int vector<T>::round( const vector<T>& X );
int vector<int>::roundtoI( const vector<T>& X );
int vector<long>::roundtoLI( const vector<T>& X );
Pascal/Delphiuses VFmath;
function VF_round( Y, X:fVector; size:UIntSize ): IntBool;
function VF_roundtoI( Y:iVector; X:fVector; size:UIntSize ): IntBool;
function VF_roundtoLI( Y:liVector; X:fVector; size:UIntSize ): IntBool;

    (similarly all other functions of this family)
CUDA function C/C++#include <cudaVFmath.h>
int cudaVF_round( fVector d_Y, fVector d_X, ui size );
int cudaVF_roundtoI( iVector d_Y, fVector d_X, ui size );
int VFcu_round( fVector h_Y, fVector h_X, ui size );
int VFcu_roundtoI( iVector h_Y, fVector h_X, ui size );
CUDA function Pascal/Delphiuses VFmath;
function cudaVF_round( d_Y, d_X:fVector; size:UIntSize ): IntBool;
function cudaVF_roundtoI( d_Y:iVector; d_X:fVector; size:UIntSize ): IntBool;
function VFcu_round( h_Y, h_X:fVector; size:UIntSize ): IntBool;
function VFcu_roundtoI( h_Y:iVector; h_X:fVector; size:UIntSize ): IntBool;
DescriptionEach element of X is rounded to the nearest integer value. In case of a fractional part of exactly 0.5, the nearest even integer value is chosen and stored in Y. For example, 2.5 is rounded to 2, and 3.5 is rounded to 4.
The functions VF_roundtoI,   VF_roundtoLI,   VF_roundtoU, etc. convert the result into the various integer data types.
Error handlingOVERFLOW and DOMAIN errors are handled "silently", i.e., without any error message and without being indicated by the return value. In the case of OVERFLOW errors, the result is set to the extreme value possible. Negative numbers in the versions VF_roundtoU,   VF_roundtoUB,   VF_roundtoUS,   VF_roundtoUL, and VF_roundtoUI (which would lead to DOMAIN errors) are handled by setting the result to 0.
Return valuealways FALSE (0)
See alsoVF_ceil,   VF_floor,   VF_chop,   VF_trunc

VectorLib Table of Contents  OptiVec home