Socket
Book a DemoInstallSign in
Socket

float-equal

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

float-equal

Check if two floats are almost equal

latest
Source
npmnpm
Version
3.0.0
Version published
Weekly downloads
164
-37.88%
Maintainers
1
Weekly downloads
 
Created
Source

float-equal

Check if two floats are almost equal

Due to rounding errors you shouldn't compare floats directly. Instead this module takes an upperbound for rounding errors into consideration.

Install

$ npm install float-equal

Usage

import floatEqual from 'float-equal';

console.log(0.1 + 0.2 === 0.3);
//=> false

console.log(floatEqual(0.1 + 0.2, 0.3));
//=> true

Keywords

float

FAQs

Package last updated on 07 Apr 2021

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