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

get_median(?Var, -Median)

Returns the median of the interval of the IC variable Var.
Var
A variable or a number
Median
The median of the interval (float)

Description

Returns the median of the interval of Var (usually so that the interval can be split) as a float value. If Var has not been declared before, it will be turned into an unrestricted real variable as a side effect. If Var is a ground number, the median is a float equal or near that number. Generally, the median splits the interval logarithmically so that the two subintervals have roughly the same number of representable floats. Only in the vicinity of zero, splitting is linear to prevent the sub- intervals from getting too small.

Modes and Determinism

Examples

[eclipse 2]: X :: 10..1000, get_median(X, M).
X = X{10 .. 1000}
M = 100.0
Yes (0.00s cpu)

[eclipse 3]: X :: -1..1000, get_median(X, M).
X = X{-1 .. 1000}
M = 11.633369384516794
Yes (0.00s cpu)

[eclipse 4]: get_median(3, M).
M = 3.0
Yes (0.00s cpu)

See Also

get_delta / 2, get_bounds / 3, get_float_bounds / 3