Skip to content

API Float64Array

Liu.Yandong.Hanks edited this page Aug 19, 2026 · 3 revisions

Float64Array

固定长度双精度浮点数组

Fixed-length double-precision floating-point array

脚本 API 目录

概述

Float64Array 使用连续的原生 double 存储分数、一般数值、NaN 和无穷值。长度固定,不支持动态增删元素。

Float64Array uses contiguous native double storage for fractions, general numeric values, NaN, and infinities. Its length is fixed and elements cannot be dynamically added or removed.

new Float64Array([length])

Parameters:

  • length
    可选的非负长度。

    Optional non-negative length.

Returns

元素初始化为 0Float64Array

An array initialized to 0.

var weights = new Float64Array(2);
weights[0] = 1.25;
return weights[0];

length

用途

返回固定长度。

Returns the fixed length.

return new Float64Array(5).length; // 5

fill([value])

Parameters:

  • value
    可选数值;缺省为 0

    Optional number; defaults to 0.

Returns

当前数组。

This array.

var rates = new Float64Array(3);
rates.fill(0.5);
return rates[1]; // 0.5

Clone this wiki locally