# Math

## IceMan Reference Guide |

#### Math

Most of these functions correspond to the C math library
equivalents, and are called on a per-pixel basis. Given the
limited precision of *Fractional* and *FixedPoint*
types, some operations must be used with care. (Values are
automatically clamped to the legal range).

`ice.Image Abs()`- Absolute value.
`ice.Image Add(b)`*b:*second operand (ice.Image).Add two images.

`ice.Image AddWrap(b)`*b:*second operand (ice.Image).Add two images, but wrap the result so that it falls in the range 0-1. Something like a floating point modulo operation.

`ice.Image ACos()`- Inverse cosine.
`ice.Image ASin()`- Inverse sine.
`ice.Image ATan()`- Inverse tangent.
`ice.Image ATan2(x)`*x:*Base (ice.Image).Inverse tangent operation. The image being operated upon is the perpendicular, or

*y*.`ice.Image Ceil()`- Round up to nearest integer.
`ice.Image Cos()`- Cosine.
`ice.Image Cosh()`- Hyperbolic cosine.
`ice.Image Divide(b)`*b:*Denominator (ice.Image).Divide one image by another: the image being operated upon is the numerator.

`ice.Image Exp()`- Inverse natural logarithm.
`ice.Image Floor()`- Round down to nearest integer.
`ice.Image Hypot(b)`*b:*Second side of the "triangle" (ice.Image).Compute the hypotenuse of a triangle: the image being operated upon is the first operand.

`ice.Image Ln()`- Natural logarithm.
`ice.Image Max(b)`*b:*Second operand (ice.Image).Result is the maximum of the two inputs.

`ice.Image Min(b)`*b:*Second operand (ice.Image).Result is the minimum of the two inputs.

`ice.Image Multiply(b)`*b:*Multiplicand (ice.Image).Multiply two images. The multiplier is the image being operated upon.

`ice.Image MultiplyAccumulate(b, c)`*b*: Scale (ice.Image).

*c*: Offset (ice.Image).Mutiply image

*a*by*b*and add*c*.`ice.Image MultiplyComplement(b)`*b:*Second operand (ice.Image).Implements

*a * (1 − b)*.*a*is the image being operated upon.`ice.Image Pow(b)`*b:*Second operand (ice.Image).Raise this image to the

*b*power.`ice.Image Round()`- Round to nearest integer.
`ice.Image Sign()`- Signum function. Return value is 1 for positive values,
and −1 for negative ones.
*(Note: Should probably be called Sgn(), to conform to common mathematics convention).* `ice.Image Sine()`- Sine function.
`ice.Image Sinh()`- Hyperbolic sine.
`ice.Image SmoothStep(min, max)`*min:*Lower threshold (ice.Image).

*max:*Upper threshold (ice.Image).Return 0 if less than the lower threshold, 1 if greater than the upper threshold, and smoothly varying in between. (A cubic is used, with

*c1*continuity at both ends).`ice.Image Subtract(b)`*b:*Subtrahend (ice.Image).Subtract two images. The minuend is the image being operated upon.

`ice.Image Tan()`- Tangent function.
`ice.Image Tanh()`- Hyperbolic tangent.