Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ieee754

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ieee754

Read/write IEEE754 floating point numbers from/to a Buffer or array-like object

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38M
decreased by-22.27%
Maintainers
1
Weekly downloads
 
Created

What is ieee754?

The ieee754 package provides functions to read and write IEEE 754 floating-point numbers from and to a Buffer or array-like object. This is particularly useful for dealing with binary data formats that require precise handling of floating-point numbers according to the IEEE 754 standard, which is widely used in computing.

What are ieee754's main functionalities?

Reading floating-point numbers

This feature allows you to read IEEE 754 floating-point numbers from a buffer. The example demonstrates reading a 32-bit floating-point number (in this case, an approximation of Pi) from a buffer.

const ieee754 = require('ieee754');
let buffer = new Buffer([0x40, 0x49, 0x0f, 0xd0]);
let value = ieee754.read(buffer, 0, true, 23, 4);
console.log(value); // Outputs: 3.1415927410125732

Writing floating-point numbers

This feature enables you to write IEEE 754 floating-point numbers to a buffer. The example shows how to write the value of Pi as a 32-bit floating-point number into a buffer.

const ieee754 = require('ieee754');
let buffer = new Buffer(4);
ieee754.write(buffer, Math.PI, 0, true, 23, 4);
console.log(buffer); // Outputs: <Buffer 40 49 0f db>

Other packages similar to ieee754

Keywords

FAQs

Package last updated on 27 Oct 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc