[ library(gfd) | Reference Manual | Alphabetic Index ]

# get_median(?Var, -Median)

Returns the median of the domain of the GFD domain variable Var.

Var
  A (domain) variable or an integer
Median
  The median of the domain

## Description

Returns the median of the domain of Var, i.e. if there are N values in the domain, the N/2'th (rounded down if N is odd) value is returned. If Var is not a GFD domain variable, it will be turned into one. Note that this is different from the definition used in IC, where the median (a float) of the interval is returned. If Var is an integer, the median is unified with that number.

### Modes and Determinism

- get_median(?, -) is det

## Examples

    [eclipse 2]: X :: 10..1000, get_median(X, M).

    X = X{10 .. 1000}
    M = 500

    [eclipse 2]: A :: [2,3,100,1000], get_median(A,M).

    A = A{[2, 3, 100, 1000]}
    M = 3

    [eclipse 2]: get_median(3, M).

    M = 3

## See Also

get_delta / 2, get_bounds / 3