Bigmath
:heavy_plus_sign: :heavy_minus_sign: :x: :heavy_division_sign: arithmetic operators for arbitrary-precision numbers
Install / Use
/learn @ahdinosaur/BigmathREADME
bigmath
arithmetic operators for arbitrary-precision numbers using bignumber.js
rather than constructing BigNumber instances from your numbers and using instance methods, this module provides the same methods as static functions.
npm install --save bigmath
example
test('BigMath', function (t) {
t.ok(BigMath, 'module is require-able')
t.equal(BigMath.add('1', '2'), '3', '1 + 2 = 3')
t.equal(BigMath.sub('1', '2'), '-1', '1 - 2 = -1')
t.equal(BigMath.mul('1', '2'), '2', '1 * 2 = 2')
t.equal(BigMath.div('1', '2'), '0.5', '1 / 2 = 0.5')
t.end()
})
usage
BigMath = require('bigmath')
BigMath is an grab-bag of the following operators from bignumber.js:
(note: if the operator normally returns a BigNumber, our operator instead returns a string using .valueOf().)
absoluteValueabsceilcomparedTocmpdecimalPlacesdpdividedBydivdividedToIntegerBydivToIntequalseqfloorgreaterThangtgreaterThanOrEqualTogteisFiniteisIntegerisIntisNaNisNegativeisNegisZerolessThanltlessThanOrEqualTolteminussubmodulomodnegatednegplusaddprecisionsdroundshiftsquareRootsqrttimesmaxminmultoDigitstoExponentialtoFixedtoFormattoFractiontoJSONtoNumbertoPowerpowrandomtoPrecisiontoStringtruncatedtruncvalueOf
license
The Apache License
Copyright © 2017 Michael Williams
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
