Socket
Book a DemoInstallSign in
Socket

gamp

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gamp

Provide a four operations calculator API with workaround for the common floating-point issue

0.2.1
latest
npmnpm
Version published
Weekly downloads
214
-60.22%
Maintainers
1
Weekly downloads
 
Created
Source

gamp

This small lib provides a four operations calculator API with workaround for the common floating-point issue.

How to use

You can either require it using requireJS, import it inside your Node.js project, or just load it using regular script tag.

The API is pretty simple:

  • gamp.add(left, right): returns the result of the addition of the right operand to the left operand
  • gamp.sub(left, right): returns the result of the subtraction of the right operand from the left operand
  • gamp.mul(left, right): returns the results of the multiplication of the left operand by the right operand
  • gamp.div(left, right): returns the results of the division of the left operand by the right operand
  • gamp.pow(left, right): returns the results of the power of the left operand by the right operand
  • gamp.normalize(value, factor): normalizes the value by a factor and rounds it
  • gamp.round(value, [digits=16]): rounds a value to a particular number of digits (default 16)
  • gamp(value1, value2, ..., valueN): computes the shared precision of the provided decimal numbers. This precision is the decimal factor needed to normalize the values in order to prevent the floating-point round-off error.

Keywords

floating-point

FAQs

Package last updated on 19 Aug 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.