Coder Social home page Coder Social logo

better-strint's Introduction

BetterStrint

BetterStrint – a JavaScript library for string-encoded integers

BetterStrint is a plug-in designed to deal with arbitrarily large integers. The core inspiration comes from the implementation of strint, so BetterStrint API is generally compatible with strint. More importantly, BetterStrint also extends some functions

Support the calculation of positive and negative numbers (addition, subtraction, multiplication, division, etc.), comparison (greater than less than, etc.)

Install

npm install better-strint -S
import BetterStrint from 'better-strint'
 
console.log(BetterStrint.add("123","456"))  // 579

CDN

<script src="https://unpkg.com/better-strint@latest/dist/better-strint.js"></script>

<!-- minify -->
<script src="https://unpkg.com/better-strint@latest/dist/better-strint.min.js"></script>
console.log(BetterStrint.add("123","456"))  // 579

API

方法名 说明 参数:类型
abs(x) 返回参数 x 绝对值 string
add(x, y) 返回 x + y 的值 x : string , y : string
div(x, y) 返回 x / y 的值 x : string , y : string
eq(x, y) 判断 x == y x : string , y : string
ge(x, y) 判断 x ≥ y x : string , y : string
gt(x, y) 判断 x > y x : string , y : string
le(x, y) 判断 x ≤ y x : string , y : string
lt(x, y) 判断 x < y x : string , y : string
negate(x) 返回 x 的相反值 x : string
pow(x, y) 返回 x 的 y 次幂 x : string , y : number
quotientRemainderPositive(x, y) 商剩余正数:返回值为一个数组,数组中有两个元素,索引0:x/y的商;索引1:x/y的余数 x : string , y : string
sub(x, y) 返回 x - y 的值 x : string , y : string
subPositive(x, y) 返回 x - y 的值,值必须为正整数 x : string , y : string
sum(...arg) 求所有参数的和 ...arg : string
multiply(x, y) 返回 x * y 的值 x : string , y : string

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.