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

modulo

modulo( 
x_integer1 
x_integer2 
)
=> x_integer

Description

Returns the remainder of dividing two integers. The remainder always has the sign of the divisor.

The remainder (mod) and modulo functions differ on negative arguments. The remainder is either zero or has the sign of the dividend if you use the remainder function. With modulo the return value always has the sign of the divisor.

Arguments

x_integer1

Dividend.

x_integer2

Divisor.

Value Returned

x_integer

The remainder of the division. The sign is determined by the divisor.

Examples

modulo( 13 4)         
=> 1
remainder( 13 4)
=> 1
modulo( -13 4)        
=> 3
remainder( -13 4)
=> -1
modulo( 13 -4)        
=> -3
remainder( 13 -4)
=> 1
modulo( -13 -4)       
=> -1
remainder( -13 -4)
=> -1

Related Topics

mod

modf

remainder


Return to top
 ⠀
X