All Projects → MaxGraey → as-bignum

MaxGraey / as-bignum

Licence: Apache-2.0 license
Fixed length big numbers for AssemblyScript 🚀

Programming Languages

WebAssembly
147 projects
typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to as-bignum

klibcpp
kedixa's Cplusplus Library(timer, multiarray, unsigned_bigint, bigint, rational)
Stars: ✭ 17 (-65.31%)
Mutual labels:  bignum, biginteger, bigint
break infinity.js
A replacement for decimal.js for incremental games who want to deal with very large numbers (bigger in magnitude than 1e308, up to as much as 1e(9e15) ) and want to prioritize speed over accuracy.
Stars: ✭ 145 (+195.92%)
Mutual labels:  bignum, biginteger, bigdecimal
BigNumber
A really long long long long long long number in C++
Stars: ✭ 37 (-24.49%)
Mutual labels:  biginteger, bigint
UInt256
An UInt256 library written in Swift 4
Stars: ✭ 20 (-59.18%)
Mutual labels:  biginteger, bigint
bigint
bigint is a C++ library which can handle Very very Big Integers. It can calculate factorial of 1000000... it can go any big. It may be useful in Competitive Coding and Scientific Calculations which deals with very very large Integers. It can also be used in Decryption process. It has many inbuilt functions which can be very useful.
Stars: ✭ 34 (-30.61%)
Mutual labels:  biginteger, bigint
Base62
PHP Base62 encoder and decoder for integers and big integers with Laravel 5 support.
Stars: ✭ 16 (-67.35%)
Mutual labels:  biginteger, bigint
intx
intx – extended precision integer library
Stars: ✭ 83 (+69.39%)
Mutual labels:  biginteger, int128
swift-numberkit
Advanced numeric data types for Swift 5, including BigInt, Rational, and Complex numbers.
Stars: ✭ 47 (-4.08%)
Mutual labels:  biginteger, bigint
BigInteger
Be limited not by the size of your register but by the bulk of your RAM.
Stars: ✭ 13 (-73.47%)
Mutual labels:  biginteger, bigint
libzahl
Suckless big integer library
Stars: ✭ 24 (-51.02%)
Mutual labels:  bignum, bigint
assemblyscript-regex
A regex engine for AssemblyScript
Stars: ✭ 81 (+65.31%)
Mutual labels:  assemblyscript
spfpm
Package for performing fixed-point, arbitrary-precision arithmetic in Python.
Stars: ✭ 61 (+24.49%)
Mutual labels:  fixed-point
DataTypes
Built-in data types
Stars: ✭ 34 (-30.61%)
Mutual labels:  bigint
hebimath
arbitrary precision arithmetic library
Stars: ✭ 37 (-24.49%)
Mutual labels:  bignum
wasm4
Build retro games using WebAssembly for a fantasy console.
Stars: ✭ 711 (+1351.02%)
Mutual labels:  assemblyscript
examples
A collection of AssemblyScript examples.
Stars: ✭ 233 (+375.51%)
Mutual labels:  assemblyscript
decimal
An arbitrary-precision decimal floating-point arithmetic package for Go
Stars: ✭ 28 (-42.86%)
Mutual labels:  bignum
pallet-contracts-waterfall
Collection of simple Substrate smart contract examples written in Rust, AssemblyScript, Solang and the smart contract language ink! to test substrates pallet-contracts module
Stars: ✭ 28 (-42.86%)
Mutual labels:  assemblyscript
nein-math
NeinMath is playing around with arbitrary precision integers, written in pure managed code, not using any unsafe stuff, and a bit faster than the build-in .NET type for integers with a few thousand bits.
Stars: ✭ 14 (-71.43%)
Mutual labels:  biginteger
abacus
📐 C# cross precision 3D maths library.
Stars: ✭ 35 (-28.57%)
Mutual labels:  fixed-point

NPM registryBuild StatusNPM license

WebAssembly fixed length big numbers written on AssemblyScript

Status: Work in progress

Provide wide numeric types such as u128, u256, i128, i256 and fixed points and also its arithmetic operations.

Namespace safe contain equivalents with overflow/underflow traps.

All kind of types pretty useful for economical and cryptographic usages and provide deterministic behavior.

Install

yarn add as-bignum

or

npm i as-bignum

Usage via AssemblyScript

import { u128 } from "as-bignum/assembly";
// Before 0.20.x
// import { u128 } from "as-bignum";

declare function logF64(value: f64): void;
declare function logU128(hi: u64, lo: u64): void;

var a = u128.One;
var b = u128.from(-32); // same as u128.from<i32>(-32)
var c = new u128(0x1, -0xF);
var d = u128.from(0x0123456789ABCDEF); // same as u128.from<i64>(0x0123456789ABCDEF)
var e = u128.from('0x0123456789ABCDEF01234567');
var f = u128.fromString('11100010101100101', 2); // same as u128.from('0b11100010101100101')
var r = d / c + (b << 5) + e;

logF64(r.as<f64>());
logU128(r.hi, r.lo);

Usage via JavaScript/Typescript

TODO

List of types

  • u128 unsigned type (tested)
  • u256 unsigned type (very basic)
  • i128 signed type
  • i256 signed type

  • safe.u128 unsigned type (tested)

  • safe.u256 unsigned type

  • safe.i128 signed type

  • safe.i256 signed type


  • fp128<Q> generic fixed point signed type٭ (very basic for now)
  • fp256<Q> generic fixed point signed type٭

  • safe.fp128<Q> generic fixed point signed type٭
  • safe.fp256<Q> generic fixed point signed type٭

٭ typename Q is a type representing count of fractional bits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].