Socket
Book a DemoInstallSign in
Socket

robust-sequence-to-fixed-point

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

robust-sequence-to-fixed-point

Turn a sequence of floats into a fixed point value

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

robust-sequence-to-fixed-point

Converts a non-overlapping increasing sequence of numbers into a fixed point big number representation.

Example

var toFixed = require("robust-to-fixed-point")

var seq = [Math.pow(2, -200), Math.pow(2, 200)]

console.log(toFixed(seq).toString(16))

Output:

4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Install

npm install robust-sequence-to-fixed-point

API

var toFixed = require("robust-sequence-to-fixed-point")

toFixed(seq)

Converts a sequence of floats into a fixed point bignumber.

  • seq is a sequence of floating point values

Returns A fixed point big integer, with the decimal point at 2^1074.

toFixed.DECIMAL_POINT

The binary position of the decimal point

Is always 1074

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

robust

FAQs

Package last updated on 05 May 2014

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