Skip to main content

round

function round(num): number;

Round the floating point number away from zero, which is different from Math.round

Parameters

ParameterTypeDescription
numnumberThe number to round

Returns

number

Example

round(0.5) // 1
round(-0.5) // -1