Socket
Socket
Sign inDemoInstall

@webassemblyjs/ieee754

Package Overview
Dependencies
1
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @webassemblyjs/ieee754

IEEE754 decoder and encoder


Version published
Weekly downloads
23M
increased by2.63%
Maintainers
1
Install size
11.5 kB
Created
Weekly downloads
 

Package description

What is @webassemblyjs/ieee754?

The @webassemblyjs/ieee754 package is designed for encoding and decoding floating-point numbers according to the IEEE 754 standard. This is particularly useful when working with WebAssembly, as it allows for precise handling of floating-point numbers in a format that's compatible with WebAssembly's binary representation.

What are @webassemblyjs/ieee754's main functionalities?

Encoding floating-point numbers

This feature allows you to encode JavaScript floating-point numbers into a format that's compatible with WebAssembly's binary representation. The example shows how to encode the number 1.5 as a 64-bit floating-point number.

const { encode } = require('@webassemblyjs/ieee754');
const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
encode(view, 0, 1.5, 64);

Decoding floating-point numbers

This feature allows you to decode floating-point numbers from a binary format into JavaScript numbers. The example demonstrates decoding a 64-bit floating-point number from a DataView into a JavaScript number.

const { decode } = require('@webassemblyjs/ieee754');
const buffer = new ArrayBuffer(8);
const view = new DataView(buffer);
view.setFloat64(0, 1.5, true);
const number = decode(view, 0, 64);

Other packages similar to @webassemblyjs/ieee754

FAQs

Last updated on 09 May 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc