repl.txt (947B)
1 2 {{alias}}( arr, dtype ) 3 Converts an input array to an array of a different data type. 4 5 The function supports the following data types: 6 7 - float32: single-precision floating-point numbers. 8 - float64: double-precision floating-point numbers. 9 - generic: values of any type. 10 - int16: signed 16-bit integers. 11 - int32: signed 32-bit integers. 12 - int8: signed 8-bit integers. 13 - uint16: unsigned 16-bit integers. 14 - uint32: unsigned 32-bit integers. 15 - uint8: unsigned 8-bit integers. 16 - uint8c: unsigned clamped 8-bit integers. 17 18 Parameters 19 ---------- 20 arr: Array|TypedArray 21 Array to convert. 22 23 dtype: string 24 Output data type. 25 26 Returns 27 ------- 28 out: Array|TypedArray 29 Output array. 30 31 Examples 32 -------- 33 > var arr = [ 1.0, 2.0, 3.0, 4.0 ]; 34 > var out = {{alias}}( arr, 'float32' ) 35 <Float32Array>[ 1.0, 2.0, 3.0, 4.0 ] 36 37 See Also 38 -------- 39