Giter Site home page Giter Site logo

ipxxiao / accurate-core Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 1.09 MB

解决JavaScript与Node.js精度计算(小数、浮点数计算精度)问题,轻量级、性能较高。An lightweight and High performance precision calculation for JavaScript and Node.js.

Home Page: https://ipxxiao.github.io/accurate-core

License: MIT License

TypeScript 43.38% JavaScript 56.62%
accurate-core precision accuracy arithmetic calculation floating-point performance-precision-calculation javascript javascript-node decimals lightweight

accurate-core's Introduction

Accurate-core · NPM version NPM downloads Build Status Coverage Status code style: prettier

  • An lightweight and high performance precision calculation for JavaScript and Node.js.
  • 解决 JavaScript 与 Node.js 精度计算(浮点数计算精度)问题,轻量级、性能较高。

Browsers support

IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Opera
Opera
IE8+ Edge+ last 10 versions last 10 versions last 2 versions last 2 versions last 2 versions

Install

npm i accurate-core -S
or
yarn add accurate-core

Features

  • Lightweight.

  • High performance.

  • No dependencies.

  • Runs on any JavaScript engine.

  • Is easily extensible.

  • Open source.

  • 轻量级。

  • 性能较高。

  • 没有依赖。

  • 运行在任何 JavaScript 引擎。

  • 易于扩展。

  • 开源的。

More features

Usage

import accurateCalc, {
  add, addition, subtract, subtraction, multiply, mul, multiplication, division, divide, modulo, modulus
} from 'accurate-core'
or
const accurateCalc, {
  add, addition, subtract, subtraction, multiply, mul, multiplication, division, divide, modulo, modulus
} = require('accurate-core')

. add(加法)

>
1.1 + 0.3
accurateCalc.add(1.1, 0.3)
addition(1.1, 0.3)

<-
1.4000000000000001
1.4
1.4

. subtract(减法)

>
1.1 - 0.2
accurateCalc.subtract(1.1, 0.2)
subtraction(1.1, 0.2)

<-
0.9000000000000001
0.9
0.9

. multiply(乘法)

>
1.1 * 0.1
accurateCalc.multiply(1.1, 0.1)
accurateCalc.mul(1.1, 0.1)
multiplication(1.1, 0.1)

<-
0.11000000000000001
0.11
0.11
0.11

. division(除法)

>
1.1 / 10
accurateCalc.division(1.1, 10)
accurateCalc.divide(1.1, 10)

<-
0.11000000000000001
0.11
0.11

. modulo(取模)

>
1.1 % 1
accurateCalc.modulo(1.1, 1)
accurateCalc.modulus(1.1, 1)

<-
0.10000000000000009
0.1
0.1

More

accurate-core's People

Contributors

dependabot[bot] avatar ipxxiao avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

zwuser

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.