Skip to content

Arithmetic functions

ndsl.stencils offers the following arithmetic functions as building blocks:

dim(a, b)

Calculates a - b, camped to 0, i.e. max(a - b, 0).

sign(a, b)

Defines a_sign_b as the absolute value of a, and checks if b is positive or negative, assigning the analogous sign value to a_sign_b. a_sign_b is returned.

Parameters:

Name Type Description Default
a

A number

required
b

A number

required