[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/DataView/setFloat16 [Back]  [Original]

DataView.prototype.setFloat16() - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

DataView.prototype.setFloat16()

Baseline 2025
Newly available

Since 2025 4, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

DataView setFloat16() DataView 2 16 . , .

In this article

// Create an ArrayBuffer with a size in bytes
const buffer = new ArrayBuffer(16);

const view = new DataView(buffer);
view.setFloat16(1, Math.PI);

console.log(view.getFloat16(1));
// Expected output: 3.140625

js
setFloat16(byteOffset, value)
setFloat16(byteOffset, value, littleEndian)

byteOffset

.

value

. .

littleEndian Optional

. false undefined .

undefined.

RangeError

byteOffset .

setFloat16()

js
const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setFloat16(0, 3);
dataview.getFloat16(1); // 0

Specification
ECMAScript 2027 LanguageSpecification
# sec-dataview.prototype.setfloat16


Web Proxy Viewer  |  New URL  |  Original Page