Skip to content

Utils.Function.getMedian

Christian d'Heureuse edited this page Sep 25, 2026 · 1 revision

commons-math-interpolation / Utils / getMedian

Function: getMedian()

function getMedian(a): number;

Defined in: Utils.ts:206

Returns the median of an array of numbers.

If the number of values is even, the mean of the two middle values is returned. The passed array is not modified.

Parameters

a

ArrayLike<number>

The values. They should not contain NaN, otherwise the result is meaningless.

Returns

number

The median, or NaN if the array is empty.

Clone this wiki locally