ieee754
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
IEEE754 is a hardware-independent system in JavaScript for binary floating-point arithmetic. It allows you to read and write IEEE754 floating point numbers from/to a Buffer or any array-like object. This becomes crucial in various applications as IEEE754 is a widespread standard for floating-point computation, due to its balance between range, precision and speed.
Using IEEE754 in your JavaScript project is straightforward. You begin by installing the package via npm using the command npm install ieee754
. Then, you require it in your project with var ieee754 = require('ieee754')
.
Here are examples of how to use the read and write functions:
To read:
var buffer = new ArrayBuffer(8);
var ieee754_read = ieee754.read(buffer, 0, false, 52, 8);
To write:
var buffer = new ArrayBuffer(8);
ieee754.write(buffer, value, 0, false, 52, 8);
In these samples, the parameters are as follows:
Remember, for the write function you'll also need to specify the value you want to record.
The IEEE754 documentation can be found in the README.md
file in the root directory of the package repository. The file includes detailed information about how to use the package, as well as explanations of the mathematical concepts involved. For more background on the IEEE Standard for Floating-Point Arithmetic, you can follow the link provided to the corresponding Wikipedia page.