View source

class thx.ArrayFloats

import thx.Arrays;

Available on all platforms

Helper class for Array<Float>.

Class Fields

static function average(arr:ReadonlyArray<Float>):Float

Finds the average of all the elements in the array.

It returns NaN if the array is empty.

static function compact(arr:ReadonlyArray<Null<Float>>):Array<Float>

Filters out all null or Math.NaN floats in the array

static function max(arr:ReadonlyArray<Float>):Null<Float>

Finds the max float element in the array.

static function min(arr:ReadonlyArray<Float>):Null<Float>

Finds the min float element in the array.

static function resize(array:Array<Float>, length:Int, fill:Float = 0.0):Array<Float>

Resizes an array of Float to an arbitrary length by adding more elements (default is 0.0) to its end or by removing extra elements.

Note that the function changes the passed array and doesn't create a copy.

static function standardDeviation(array:ReadonlyArray<Float>):Float

Returns the sample standard deviation of the sampled values.

static function sum(arr:ReadonlyArray<Float>):Null<Float>

Finds the sum of all the elements in the array.

Toggle inherited fields