Product Documentation
Virtuoso Parameterized Cell SKILL Reference
Product Version IC23.1, August 2023

pcRound

pcRound( 
n_num 
[ f_precision ]
[ x_tolerance ]
)
=> x_result

Description

Lets you round a number to the closest integer, using the value of the decimal place specified by x_tolerance; additional decimal places are ignored. If the value of the specified decimal place is less than 5, the system drops all decimal places; if the value of the specified decimal place is greater than or equal to 5, the system drops all decimal places and adds one to the integer.

Arguments

n_num

Any number you want to round.

f_precision

Floating-point number specifying number of decimal places to the right of the decimal point to use as a range for determining whether n_num is close to a whole number.

Default: 0.001

x_tolerance

Positive integer specifying the decimal place to use for rounding. For example, a value of 1 specifies 0.5, 2 specifies 0.05, 3 specifies 0.005, 4 specifies 0.0005, and so on. The numbers in other decimal places are ignored.

Default: 1

Value Returned

x_result

An integer. If n_num does not contain a number, an error occurs; look in the CIW or at the CDS.log file for a message about the error.

Examples

The examples below show numbers rounded using pcRound.

pcRound( 1.49 )  results in  1
pcRound( -1.49)   results in  -1
pcRound( 1.59 )   results in  2
pcRound( -1.59 )  results in  -2
pcRound( 5.4993 0.001 1 )  results in 6
pcRound( 5.4993 0.001 2 )  results in 5
pcRound( 5.4993 0.002 1 )  results in 6
pcRound( 5.4993 0.0002 1 ) results in 5

Related Topics

pcFix
pcExprToString
pcTechFile
Recommended, Supported SKILL Functions for Pcells

Return to top
 ⠀
X