DataView.prototype.getFloat64
Gets a 64-bit float (double) at the specified byte offset from the start of the DataView
Syntax
dataView.getFloat64(byteOffset, littleEndian?)Parameters
| Parameter | Type | Description |
|---|---|---|
| byteOffset | number | The offset in bytes to read from |
| littleEndian | boolean | If true, read as little-endian |
Return Value
A 64-bit floating point number
Examples
const buffer = new ArrayBuffer(8)
const view = new DataView(buffer)
view.setFloat64(0, Math.PI)
console.log(view.getFloat64(0)) // 3.141592653589793function readDoubles(buffer: ArrayBuffer): number[] {
const view = new DataView(buffer)
const count = buffer.byteLength / 8
const result: number[] = []
for (let i = 0; i < count; i++) {
result.push(view.getFloat64(i * 8))
}
return result
}const buffer = new ArrayBuffer(16)
const view = new DataView(buffer)
view.setFloat64(0, 1.23456789)
view.setFloat64(8, -9.87654321)
console.log(view.getFloat64(0), view.getFloat64(8))Understanding DataView.prototype.getFloat64
The DataView.prototype.getFloat64 method in JavaScript gets a 64-bit float (double) at the specified byte offset from the start of the DataView. It belongs to the DataView object and is one of the most widely used methods for working with dataview values in modern JavaScript and TypeScript applications.
The method signature is dataView.getFloat64(byteOffset, littleEndian?). It accepts 2 parameters: byteOffset, littleEndian. When called, it returns a 64-bit floating point number. Understanding when and how to use getFloat64() helps you write more expressive, readable code.
Common use cases for DataView.prototype.getFloat64 include data transformation, input validation, API response processing, and building reusable utility functions. It works well alongside related methods like dataview-getint32, dataview-constructor, float64array-constructor, enabling you to chain operations together for complex data manipulation pipelines.
Browser support for DataView.prototype.getFloat64 is excellent across all modern browsers including Chrome, Firefox, Safari, and Edge. It is also fully supported in Node.js and Deno. For older environments, transpilation with Babel or a polyfill may be needed.
Browser Compatibility
Supported in all modern browsers (Chrome, Firefox, Safari, Edge) and Node.js. Part of the ECMAScript standard.
Related Methods
DataView.prototype.getInt32Gets a signed 32-bit integer at the specified byte offset from the start of the DataView
DataViewCreates a new DataView providing a low-level interface for reading and writing multiple number types in an ArrayBuffer
Float64ArrayCreates a new Float64Array typed array representing an array of 64-bit IEEE floating point numbers (same precision as JavaScript numbers)
More DataView Methods
Other methods in the DataView object
Related Tools
More DataView Methods
Explore JavaScript Methods
Browse our complete reference of 410 JavaScript methods with syntax, examples, and explanations.