Personal IDL library for M. Galloy

single page | use frames     summary     class     fields     routine details     file attributes


top source mg_sign

result = mg_sign(x)

Return the sign of the values of an array: -1 for negative values, 0 for 0 values, 1 for positive values. The dimensions of the result are the same as the input array.

Return value



x in required type=numeric array

input array


For example, the following finds the sign of the values in a simple array:

IDL> print, mg_sign([-3.5, 0., 4.7]) -1 0 1

File attributes

Modification date: Wed Sep 14 10:24:51 2011
Lines: 26
Docformat: rst rst
Personal library of Michael Galloy
Contact me if you have enhancement requests or bug fixes.