Skip to content

Latest commit

 

History

History
103 lines (83 loc) · 3.85 KB

File metadata and controls

103 lines (83 loc) · 3.85 KB
title ms.custom ms.date ms.prod ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic dev_langs ms.assetid caps.latest.revision author ms.author manager
Float64Array Object | Microsoft Docs
01/18/2017
windows-client-threshold
devlang-javascript
language-reference
JavaScript
TypeScript
DHTML
74c945dc-56ae-458c-b0aa-782f240e9b6c
18
mikejo5000
mikejo
ghogen

Float64Array Object

A typed array of 64-bit float values. The contents are initialized to 0. If the requested number of bytes could not be allocated an exception is raised.

Syntax

  
      float64Array = new Float64Array( length );  
float64Array = new Float64Array( array );  
float64Array = new Float64Array( buffer, byteOffset, length);  

Parameters

float64Array
Required. The variable name to which the Float64Array object is assigned.

length
Specifies the number of elements in the array.

array
The array (or typed array) that is contained in this array.. The contents are initialized to the contents of the given array or typed array, with each element converted to the Float64 type.

buffer
The ArrayBuffer that the Float64Array represents.

byteOffset
Optional. Specifies the offset in bytes from the start of the buffer at which the Float64Array should begin.

length
The number of elements in the array.

Constants

The following table lists the constants of the Float64Arrayobject.

Constant Description
BYTES_PER_ELEMENT Constant The size in bytes of each element in the array.

Properties

The following table lists the constants of the Float64Arrayobject.

Property Description
buffer Property Read-only. Gets the ArrayBuffer that is referenced by this array.
byteLength Property Read-only. The length of this array from the start of its ArrayBuffer, in bytes, as fixed at construction time.
byteOffset Property Read-only. The offset of this array from the start of its ArrayBuffer, in bytes, as fixed at construction time.
length Property The length of the array.

Methods

The following table lists the methods of the Float64Arrayobject.

Method Description
get Method Omittable. Gets the element at the specified index.
set Method (Float64Array) Sets a value or an array of values.
subarray Method (Float64Array) Gets a new Float64Array view of the ArrayBuffer store for this array.

Example

The following example shows how to use a Float64Array object to process the binary data acquired from an XmlHttpRequest:

var req = new XMLHttpRequest();  
    req.open('GET', "http://www.example.com");  
    req.responseType = "arraybuffer";  
    req.send();  
  
    req.onreadystatechange = function () {  
        if (req.readyState === 4) {  
            var buffer = req.response;  
            var dataview = new DataView(buffer);  
            var ints = new Float64Array(buffer.byteLength / 8);  
            for (var i = 0; i < ints.length; i++) {  
                ints[i] = dataview.getFloat64(i * 8);  
            }  
        alert(ints[10]);  
        }  
    }  
  

Requirements

[!INCLUDEjsv10]