; docformat = 'rst' ;+ ;Calculates the mod function as done in matlab. This will always return a ;positive number between 0 and y. ; ; :Examples: ; result = mlmod(x, y) ;- ;+ ; :Params: ; x : in, required, type=int or double or array of int or double ; Number that is on the left side of the mod operator (x % y). ; y : in, required, type=int or double or array of int or double ; Number that is on the right side of the mod operator (x % y). ; ; :Returns: ; Returns the result of the modulo operator according to matlab's mod. ; This will always return a positive number between 0 and y. ;- function mlmod,x,y if ~real_numeric_type(x) or ~real_numeric_type(y) then begin doc_library, 'mlmod' return, -1 endif return,x - floor(x/y)*y end