Float16Array
Baseline
2025
Newly available
Since â¨April 2025â©, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Float16Array íìí ë°°ì´ì íë«í¼ì ë°ì´í¸ ìì를 ë°ë¥´ë 16ë¹í¸ ë¶ë ììì ë°°ì´ì
ëë¤. ë°ì´í¸ ìì를 ì ì´í´ì¼ íë ê²½ì° ëì DataView를 ì¬ì©íì기 ë°ëëë¤. ëª
ìì ì¼ë¡ ì´ê¸°í ë°ì´í°ë¥¼ ì ê³µíì§ ìì¼ë©´ ë°°ì´ì ë´ì©ì 0ì¼ë¡ ì´ê¸°íë©ëë¤. ë°°ì´ì´ ìì±ëë©´ ê°ì²´ì ë©ìë를 ì¬ì©íê±°ë íì¤ ë°°ì´ ì¸ë±ì¤ 구문(ì¦, ëê´í¸ íê¸°ë² ì¬ì©)ì ì¬ì©íì¬ ë°°ì´ì ìì를 참조í ì ììµëë¤.
Float16Arrayë ì¨ê²¨ì§ TypedArray í´ëì¤ì íì í´ëì¤ ì
ëë¤.
ì°¸ê³ : Float16 ì§ìì JavaScript APIì íì CPU ìí¤í ì² ëª¨ëìì ë³´í¸ì ì¼ë¡ ì§ìëì§ ììµëë¤. ì´ë¥¼ ì¬ì©íë©´ ì¼ë¶ íë«í¼ìì ì±ë¥ì´ ì íë ì ììµëë¤. ì´ ê¸°ë¥ì float-backed canvases, WebGPU, WebGL, stable diffusionì í¬í¨í ë¥ë¬ë 모ë¸ê³¼ ê°ì´ ê³ ëë¡ ìµì íëê³ ì±ë¥ì 민ê°í ìì¤í ê³¼ ìí¸ ìì©í기 ìí ê²ì ëë¤.
ìì±ì
Float16Array()-
ìë¡ì´
Float16Arrayê°ì²´ë¥¼ ìì±í©ëë¤.
ì ì ìì±
ë¶ëª¨ TypedArrayìì ì ì ìì±ì ììí©ëë¤.
Float16Array.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ì ê°ì¼ë¡ ë°íí©ëë¤.
Float16Arrayì ê²½ì°2ì ëë¤.
ì ì ë©ìë
ë¶ëª¨ TypedArrayìì ì ì ë©ìë를 ììí©ëë¤.
ì¸ì¤í´ì¤ ìì±
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ìì±ì ììí©ëë¤.
ìë ìì±ì Float16Array.prototypeì ì ìëì´ ìì¼ë©°, 모ë Float16Array ì¸ì¤í´ì¤ì ê³µì í©ëë¤.
Float16Array.prototype.BYTES_PER_ELEMENT-
ìì í¬ê¸°ë¥¼ ì«ìë¡ ë°íí©ëë¤.
Float16Arrayì ê²½ì°2ì ëë¤. Float16Array.prototype.constructor-
ì¸ì¤í´ì¤ ê°ì²´ë¥¼ ìì±í ìì±ì í¨ìì ëë¤.
Float16Arrayì¸ì¤í´ì¤ì ê²½ì° ì´ê¸° ê°ìFloat16Arrayìì±ì ì ëë¤.
ì¸ì¤í´ì¤ ë©ìë
ë¶ëª¨ TypedArrayìì ì¸ì¤í´ì¤ ë©ìë를 ììí©ëë¤.
ìì
>Float16Array를 ìì±í기 ìí ê°ê¸° ë¤ë¥¸ ì¬ë¬ ë°©ë²
// 길ì´ë¡ë¶í° ìì±
const float16 = new Float16Array(2);
float16[0] = 42;
console.log(float16[0]); // 42
console.log(float16.length); // 2
console.log(float16.BYTES_PER_ELEMENT); // 2
// ë°°ì´ë¡ë¶í° ìì±
const x = new Float16Array([21, 31]);
console.log(x[1]); // 31
// ë¤ë¥¸ TypedArrayë¡ë¶í° ìì±
const y = new Float16Array(x);
console.log(y[0]); // 21
// ArrayBufferë¡ë¶í° ìì±
const buffer = new ArrayBuffer(32);
const z = new Float16Array(buffer, 4, 4);
console.log(z.byteOffset); // 4
// ìíë¡ë¶í° ìì±
const iterable = (function* () {
yield* [1, 2, 3];
})();
const float16FromIterable = new Float16Array(iterable);
console.log(float16FromIterable);
// Float16Array [1, 2, 3]
ëª ì¸ì
| Specification |
|---|
| ECMAScript® 2026 Language Specification > # sec-float16array > |