$LastChangedDate: 27-Juil-2011 $

# CL_rMod

Modulo with result in range

## Calling Sequence

       [y] = CL_rMod(x, a, b)
       [y] = CL_rMod(x, a)

## Description

- Computes a modulo in a given range.

  The result y is such that y = x modulo [b-a] with y in [a,b[. That is to say that y = x + k*(b-a) with k integer such that y belongs to [a, b[.

- Notes:

  - x can be a row or a column vector, a and b can be scalars or vectors with same sizes as x.

  - CL_rMod(x, a) is the same as CL_rMod(x, 0, a)

  - CL_rMod([], a, b) = []

## Parameters

x:

  Vector of real values (1xN or Nx1)

a:

  Minimum value (1x1) or same dimension as x

b:

  Maximum value (strictly greater than a) (1x1 or same size as a)

y:

  Result of "x modulo (b-a)" belonging to [a,b[ (same size as x)

## Authors

- CNES - DCT/SB

## Examples

    CL_rMod(2*%pi, -%pi, %pi)

    y = CL_rMod(1:20, -5, 5)