DataView.prototype.setFloat64()
The setFloat64() method of DataView instances takes a number and stores it as a 64-bit float in the 8 bytes starting at the specified byte offset of this DataView.
Try it
Syntax
js
setFloat64(byteOffset, value)
setFloat64(byteOffset, value, littleEndian)
Parameters
byteOffset-
The offset, in byte, from the start of the view where to store the data.
value-
The value to set.
littleEndianOptional-
Indicates whether the 64-bit float is stored in little- or big-endian format. If
falseorundefined, a big-endian value is written.
Return value
Errors thrown
RangeError-
Thrown if the
byteOffsetis set such as it would store beyond the end of the view.
Examples
Using the setFloat64 method
js
const buffer = new ArrayBuffer(8);
const dataview = new DataView(buffer);
dataview.setFloat64(0, 3);
dataview.getFloat64(0); // 3
Specifications
| Specification |
|---|
| ECMAScript Language Specification # sec-dataview.prototype.setfloat64 |
Browser compatibility
BCD tables only load in the browser