Product Documentation
Cadence SKILL Language Reference
Product Version IC23.1, November 2023

fix

fix( 
n_arg 
) 
=> x_result

Description

Returns the largest integer not larger than the given argument.

If the given floating point argument n_arg is greater than the maximum integer value INT_MAX, a warning message displays and the INT_MAX value is returned. Similarly, if the floating point argument n_arg is less than the minimum integer value INT_MIN, a warning message displays and the INT_MIN value is returned. This function is equivalent to floor.

Arguments

n_arg

Any number.

Value Returned

x_result

The largest integer not greater than n_arg. If an integer is given as an argument, it returns the argument.

Examples

fix(1.9)      
=> 1
fix(-5.6)     
=> -6
fix(100)      
=> 100
fix(4.1 * 100)
=> 409
fix(1.111111e10)
*WARNING* (fix): Input value 11111110000.000000 is out of range. Using the maximum integer value allowed (2147483647) instead. Check your code to ensure that all input values and calculations have been correctly specified.
=>2147483647
fix(-1.1234e20)
*WARNING* (fix): Input value -112340000000000000000.000000 is out of range. Using the minimum integer value allowed (-2147483648) instead. Check your code to ensure that all input values and calculations have been correctly specified.
=>-2147483648

Related Topics

Type Conversion Functions (fix and float)

ceiling

fixp

floor

round

Arithmetic Functions


Return to top
 ⠀
X