Code Monkey home page Code Monkey logo

float's Introduction

Float

Build Status Code Climate Test Coverage

GitHub repository: github.com/mex/float

NPM package: npmjs.org/package/float

Install

Install through NPM: npm install float

Install through Bower: bower install float

Usage

var f = require('float');

var a = 2.15;
var b = 3.46;
var c = 5.61;
var ab = f.round(a + b);
if (f.equals(ab, c) {
  console.log('They are equal!');
} else {
  console.log('Someone clearly failed at some point...');
}

Documentation

  • round(number, precision)
    • Rounds the number to the given number of decimals.
    • Parameters:
      • number (float)
      • precision (integer): Number of decimals
    • Return:
      • float
  • floor(number, precision)
    • Floors the number to the given number of decimals.
    • Parameters:
      • number (float)
      • precision (integer): Number of decimals
    • Return:
      • float
  • ceil(number, precision)
    • Ceils the number to the given number of decimals.
    • Parameters:
      • number (float)
      • precision (integer): Number of decimals
    • Return:
      • float
  • equals(a, b[, d])
    • Compares the arguments and return whether they are equal.
    • Parameters:
      • a (float)
      • b (float)
      • d (integer): Number of decimals
    • Return:
      • boolean
  • lessThan(a, b[, d])
    • Compares the arguments and return whether a is less than b.
    • Parameters:
      • a (float)
      • b (float)
      • d (integer): Number of decimals
    • Return:
      • boolean
  • lessThanOrEquals(a, b[, d])
    • Compares the arguments and return whether a is less than or equal to b.
    • Parameters:
      • a (float)
      • b (float)
      • d (integer): Number of decimals
    • Return:
      • boolean
  • greaterThan(a, b[, d])
    • Compares the arguments and return whether a is greater than b.
    • Parameters:
      • a (float)
      • b (float)
      • d (integer): Number of decimals
    • Return:
      • boolean
  • greaterThanOrEquals(a, b[, d])
    • Compares the arguments and return whether a is greater than or equal to b.
    • Parameters:
      • a (float)
      • b (float)
      • d (integer): Number of decimals
    • Return:
      • boolean

float's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.