UNB/ CS/ David Bremner/ teaching/ cs2613/ books/ mdn/ Reference/ Global Objects/ DataView/ DataView.prototype.setFloat32()

The setFloat32() method of DataView instances takes a number and stores it as a 32-bit floating point number in the 4 bytes starting at the specified byte offset of this DataView. There is no alignment constraint; multi-byte values may be stored at any offset within bounds.

Syntax

setFloat32(byteOffset, value)
setFloat32(byteOffset, value, littleEndian)

Parameters

Return value

undefined.

Exceptions

Examples

Using setFloat32()

const buffer = new ArrayBuffer(10);
const dataview = new DataView(buffer);
dataview.setFloat32(0, 3);
dataview.getFloat32(1); // 2

Specifications

Browser compatibility

See also