A Float32Array object describes an array-like view of an underlying binary data buffer.
The constructors are listed as follows:
new Float32Array(); new Float32Array(length); new Float32Array(typedArray); new Float32Array(object); new Float32Array(buffer [, byteOffset [, length]]);
Parameter | Optional | Meaning |
---|---|---|
length | Required | an internal array buffer is created of size length multiplied by BYTES_PER_ELEMENT bytes. |
typedArray | Required | the typedArray is copied into a new typed array. |
object | Required | use the Float32Array.from() method. |
buffer | Required | create from buffer |
byteOffset | optional | offset to start |
length | optional | length to copy |
Property access
You can reference elements in the array using standard array index syntax.
var int16 = new Float32Array(2); int16[0] = 42;/*w w w. j a v a 2 s. c o m*/ console.log(int16[0]); // 42
Type | Value Range | Size in bytes | Description | Equivalent C type |
---|---|---|---|---|
Float32Array | 1.2E10-38 to 3.4E10+38 | 4 | 32-bit IEEE floating point number | float |