Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

array.float

import array

Everything here is re-exported by array, so import array is enough and the names are called as array.*. Importing array.float on its own works too and reaches the same definitions.

FloatArray: a packed array of single-precision IEEE 754 floats, 4 bytes per element.

FLOAT_MAX and FLOAT_MIN are the largest and smallest finite values the type can hold.

Constants

FLOAT_MAX

array.FLOAT_MAX: number

Maximum value that “should” exist in a list passed to FloatArray.

FLOAT_MIN

array.FLOAT_MIN: number

Minimum value that “should” exist in a list passed to FloatArray.

Classes

FloatArray

class array.FloatArray < Array

class FloatArray represents an array of 32-bit IEEE-754 floating-point numbers in the platform byte order.

  • printable — has a @to_string(), so echo and print() show something useful
  • serializable — has a @to_json(), so it can be handed straight to json.encode()
  • valueable — has a @to_value(), so it converts to a plain Zuri value

FloatArray.reverse()

array.FloatArray.reverse() -> FloatArray

Returns a new array containing the elements in the original array in reverse order.

Returns FloatArray

FloatArray.clone()

array.FloatArray.clone() -> FloatArray

Returns a new FloatArray containing all items from the current array. The new array is a shallow copy of the original array.

Returns FloatArray

FloatArray.slice()

array.FloatArray.slice(start, end) -> FloatArray

Returns a new FloatArray over [start, end) of this array (both default to the whole array; negative bounds count from the end).

Parameters

  • start (?number)
  • end (?number)

Returns FloatArray


2021, Richard Ore and Zuri contributors