array-fixed-endian-float64

Float64ArrayFE.

https://github.com/stdlib-js/array-fixed-endian-float64

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.6%) to scientific vocabulary

Keywords

array big-endian data double double-precision endian float64 float64array ieee754 javascript little-endian node node-js nodejs stdlib structure typed typed-array types
Last synced: 4 months ago · JSON representation ·

Repository

Float64ArrayFE.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
array big-endian data double double-precision endian float64 float64array ieee754 javascript little-endian node node-js nodejs stdlib structure typed typed-array types
Created over 1 year ago · Last pushed 7 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security

README.md

About stdlib...

We believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js.

The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases.

When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there.

To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!

Float64ArrayFE

NPM version Build Status Coverage Status <!-- dependencies -->

Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in a specified byte order.

In contrast to the [`Float64Array`][@stdlib/array/float64] typed array constructor which stores values according to the host platform byte order, the `Float64ArrayFE` constructor allows enforcing a specific byte order. Such enforcement can be particularly advantageous when working with memory buffers which do not necessarily follow host platform byte order, such as [WebAssembly memory][@stdlib/wasm/memory].
## Installation ```bash npm install @stdlib/array-fixed-endian-float64 ``` Alternatively, - To load the package in a website via a `script` tag without installation and bundlers, use the [ES Module][es-module] available on the [`esm`][esm-url] branch (see [README][esm-readme]). - If you are using Deno, visit the [`deno`][deno-url] branch (see [README][deno-readme] for usage intructions). - For use in Observable, or in browser/node environments, use the [Universal Module Definition (UMD)][umd] build available on the [`umd`][umd-url] branch (see [README][umd-readme]). The [branches.md][branches-url] file summarizes the available branches and displays a diagram illustrating their relationships. To view installation and usage instructions specific to each branch build, be sure to explicitly navigate to the respective README files on each branch, as linked to above.
## Usage ```javascript var Float64ArrayFE = require( '@stdlib/array-fixed-endian-float64' ); ``` #### Float64ArrayFE( endianness ) A typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in a specified byte order. ```javascript var arr = new Float64ArrayFE( 'little-endian' ); // returns ``` #### Float64ArrayFE( endianness, length ) Returns a typed array having a specified length and byte order. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); // returns ``` #### Float64ArrayFE( endianness, typedarray ) Creates a typed array from another typed array. ```javascript var Float32Array = require( '@stdlib/array-float32' ); var arr1 = new Float32Array( [ 0.5, 0.5, 0.5 ] ); var arr2 = new Float64ArrayFE( 'little-endian', arr1 ); // returns var v = arr2.get( 0 ); // returns 0.5 ``` #### Float64ArrayFE( endianness, obj ) Creates a typed array from an array-like object or iterable. ```javascript var arr = new Float64ArrayFE( 'little-endian', [ 0.5, 0.5, 0.5 ] ); // returns var v = arr.get( 0 ); // returns 0.5 ``` #### Float64ArrayFE( endianness, buffer\[, byteOffset\[, length]] ) Returns a typed array view of an [`ArrayBuffer`][@stdlib/array/buffer]. ```javascript var ArrayBuffer = require( '@stdlib/array-buffer' ); var buf = new ArrayBuffer( 32 ); var arr = new Float64ArrayFE( 'little-endian', buf, 0, 4 ); // returns ``` * * * ### Properties #### Float64ArrayFE.BYTES_PER_ELEMENT Number of bytes per view element. ```javascript var nbytes = Float64ArrayFE.BYTES_PER_ELEMENT; // returns 8 ``` #### Float64ArrayFE.name Typed array constructor name. ```javascript var str = Float64ArrayFE.name; // returns 'Float64ArrayFE' ``` #### Float64ArrayFE.prototype.buffer **Read-only** property which returns the [`ArrayBuffer`][@stdlib/array/buffer] referenced by the typed array. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); var buf = arr.buffer; // returns ``` #### Float64ArrayFE.prototype.byteLength **Read-only** property which returns the length (in bytes) of the typed array. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); var byteLength = arr.byteLength; // returns 40 ``` #### Float64ArrayFE.prototype.byteOffset **Read-only** property which returns the offset (in bytes) of the typed array from the start of its [`ArrayBuffer`][@stdlib/array/buffer]. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); var byteOffset = arr.byteOffset; // returns 0 ``` #### Float64ArrayFE.prototype.BYTES_PER_ELEMENT Number of bytes per view element. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); var nbytes = arr.BYTES_PER_ELEMENT; // returns 8 ``` #### Float64ArrayFE.prototype.length **Read-only** property which returns the number of view elements. ```javascript var arr = new Float64ArrayFE( 'little-endian', 5 ); var len = arr.length; // returns 5 ``` * * * ### Methods #### Float64ArrayFE.from( endianness, src\[, map\[, thisArg]] ) Creates a new typed array from an array-like object or an iterable. ```javascript var arr = Float64ArrayFE.from( 'little-endian', [ 1.0, -1.0 ] ); // returns var v = arr.get( 0 ); // returns 1.0 ``` To invoke a function for each `src` value, provide a callback function. ```javascript function mapFcn( v ) { return v * 2.0; } var arr = Float64ArrayFE.from( 'little-endian', [ 1.0, -1.0 ], mapFcn ); // returns var v = arr.get( 0 ); // returns 2.0 ``` A callback function is provided two arguments: - **value**: source value. - **index**: source index. To set the callback execution context, provide a `thisArg`. ```javascript function mapFcn( v ) { this.count += 1; return v * 2.0; } var ctx = { 'count': 0 }; var arr = Float64ArrayFE.from( 'little-endian', [ 1.0, -1.0 ], mapFcn, ctx ); // returns var v = arr.get( 0 ); // returns 2.0 var n = ctx.count; // returns 2 ``` #### Float64ArrayFE.of( endianness, element0\[, element1\[, ...elementN]] ) Creates a new typed array from a variable number of arguments. ```javascript var arr = Float64ArrayFE.of( 'little-endian', 1.0, -1.0 ); // returns var v = arr.get( 0 ); // returns 1.0 ``` #### Float64ArrayFE.prototype.get( i ) Returns an array element located at a nonnegative integer position (index) `i`. ```javascript var arr = new Float64ArrayFE( 'little-endian', 10 ); // Set the first element: arr.set( 1.0, 0 ); // Get the first element: var v = arr.get( 0 ); // returns 1.0 ``` If provided an out-of-bounds index, the method returns `undefined`. ```javascript var arr = new Float64ArrayFE( 'little-endian', 10 ); var v = arr.get( 100 ); // returns undefined ``` #### Float64ArrayFE.prototype.set( arr\[, offset] ) Sets array elements. ```javascript var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] ); // returns var v = arr.get( 0 ); // returns 1.0 v = arr.get( 1 ); // returns 2.0 // Set the first two array elements: arr.set( [ 4.0, 5.0 ] ); v = arr.get( 0 ); // returns 4.0 v = arr.get( 1 ); // returns 5.0 ``` By default, the method starts writing values at the first array index. To specify an alternative index, provide an index `offset`. ```javascript var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] ); // returns // Set the last two array elements: arr.set( [ 4.0, 5.0 ], 1 ); var v = arr.get( 1 ); // returns 4.0 v = arr.get( 2 ); // returns 5.0 ``` A few notes: - If `i` is out-of-bounds, the method throws an error. - If a target array cannot accommodate all values (i.e., the length of source array plus `i` exceeds the target array length), the method throws an error. - If provided a typed array which shares an [`ArrayBuffer`][@stdlib/array/buffer] with the target array, the method will intelligently copy the source range to the destination range. #### Float64ArrayFE.prototype.toString() Serializes an array as a string. ```javascript var arr = new Float64ArrayFE( 'little-endian', [ 1.0, 2.0, 3.0 ] ); var str = arr.toString(); // returns '1,2,3' ```
* * * ## Notes - The constructor supports the following byte orders: - **little-endian**: store values such that bytes are stored from least-to-most significant bytes. This is the dominant ordering for processor architectures and their associated memory. This is also the ordering for [WebAssembly memory][@stdlib/wasm/memory]. - **big-endian**: store values such that bytes are stored from most-to-least significant bytes. This is the dominant ordering in network protocols. - While a `Float64ArrayFE` _strives_ to maintain (but does not **guarantee**) consistency with [typed arrays][@stdlib/array/typed], significant deviations from ECMAScript-defined [typed array][@stdlib/array/typed] behavior are as follows: - The constructor does **not** require the `new` operator. - Accessing array elements using bracket syntax (e.g., `X[i]`) is **not** supported. Instead, one **must** use the `.get()` method.
* * * ## Examples ```javascript var Float64Array = require( '@stdlib/array-float64' ); var logEach = require( '@stdlib/console-log-each' ); var Float64ArrayFE = require( '@stdlib/array-fixed-endian-float64' ); // Create a typed array by specifying a length: var out = new Float64ArrayFE( 'little-endian', 3 ); logEach( '%s', out ); // Create a typed array from an array: var arr = [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ]; out = new Float64ArrayFE( 'big-endian', arr ); logEach( '%s', out ); // Create a typed array from an array buffer: arr = new Float64Array( [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ] ); // host byte order out = new Float64ArrayFE( 'little-endian', arr.buffer ); logEach( '%s', out ); // Create a typed array from an array buffer view: arr = new Float64Array( [ 1.0, -1.0, -3.14, 3.14, 0.5, 0.5 ] ); // host byte order out = new Float64ArrayFE( 'big-endian', arr.buffer, 8, 2 ); logEach( '%s', out ); ```
* * * ## Notice This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more. For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib]. #### Community [![Chat][chat-image]][chat-url] --- ## License See [LICENSE][stdlib-license]. ## Copyright Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors].

Owner

  • Name: stdlib
  • Login: stdlib-js
  • Kind: organization

Standard library for JavaScript.

Citation (CITATION.cff)

cff-version: 1.2.0
title: stdlib
message: >-
  If you use this software, please cite it using the
  metadata from this file.

type: software

authors:
  - name: The Stdlib Authors
    url: https://github.com/stdlib-js/stdlib/graphs/contributors

repository-code: https://github.com/stdlib-js/stdlib
url: https://stdlib.io

abstract: |
  Standard library for JavaScript and Node.js.

keywords:
  - JavaScript
  - Node.js
  - TypeScript
  - standard library
  - scientific computing
  - numerical computing
  - statistical computing

license: Apache-2.0 AND BSL-1.0

date-released: 2016

GitHub Events

Total
  • Push event: 14
Last Year
  • Push event: 14

Dependencies

.github/workflows/benchmark.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
.github/workflows/cancel.yml actions
  • styfle/cancel-workflow-action 85880fa0301c86cca9da44039ee3bb12d3bedbfa composite
.github/workflows/close_pull_requests.yml actions
  • superbrothers/close-pull-request 9c18513d320d7b2c7185fb93396d0c664d5d8448 composite
.github/workflows/examples.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
.github/workflows/npm_downloads.yml actions
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
  • actions/upload-artifact 5d5d22a31266ced268874388b861e4b58bb5c2f3 composite
  • distributhor/workflow-webhook 48a40b380ce4593b6a6676528cd005986ae56629 composite
.github/workflows/productionize.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
  • stdlib-js/bundle-action main composite
  • stdlib-js/transform-errors-action main composite
.github/workflows/publish.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • JS-DevTools/npm-publish 19c28f1ef146469e409470805ea4279d47c3d35c composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
  • styfle/cancel-workflow-action 85880fa0301c86cca9da44039ee3bb12d3bedbfa composite
.github/workflows/test.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
.github/workflows/test_bundles.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
  • denoland/setup-deno 041b854f97b325bd60e53e9dc2de9cb9f9ac0cba composite
.github/workflows/test_coverage.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
  • codecov/codecov-action 84508663e988701840491b86de86b666e8a86bed composite
  • distributhor/workflow-webhook 48a40b380ce4593b6a6676528cd005986ae56629 composite
.github/workflows/test_install.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
.github/workflows/test_published_package.yml actions
  • 8398a7/action-slack 28ba43ae48961b90635b50953d216767a6bea486 composite
  • actions/checkout 8ade135a41bc03ea155e62e844d188df1ea18608 composite
  • actions/setup-node b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 composite
package.json npm
  • @stdlib/array-buffer ^0.2.2 development
  • @stdlib/array-float64 ^0.2.2 development
  • @stdlib/array-zero-to ^0.2.2 development
  • @stdlib/assert-is-arraybuffer ^0.2.2 development
  • @stdlib/assert-is-nonnegative-integer ^0.2.2 development
  • @stdlib/assert-is-number ^0.2.2 development
  • @stdlib/bench-harness ^0.2.2 development
  • @stdlib/console-log-each ^0.2.2 development
  • @stdlib/math-base-special-pow ^0.3.0 development
  • @stdlib/random-array-randu ^0.2.1 development
  • @stdlib/symbol-iterator ^0.2.2 development
  • istanbul ^0.4.1 development
  • tap-min git+https://github.com/Planeshifter/tap-min.git development
  • tape git+https://github.com/kgryte/tape.git#fix/globby development
  • @stdlib/array-fixed-endian-factory github:stdlib-js/array-fixed-endian-factory#main