frozeman / bignumber.js-nolookahead Goto Github PK
View Code? Open in Web Editor NEWBigNumber.js version with no look ahead regex for web3.js 0.x.x
License: MIT License
BigNumber.js version with no look ahead regex for web3.js 0.x.x
License: MIT License
Seems like this repository at some point copied bignumber.js, which now has moved forward. Is is possible to upgrade this repository to be compatible with Bignumber.js 7?
I'm not sure if this is an issue or a lack of my understanding on how bignumber works but I receive this error when I try create numbers larger than 10^19.
For example this creates the invalid BigNumber string value
error:
let wei = 1000000000000000000;
let totalSupply = bn(10000000).times(wei);
it('Deploy erc20', async() => {
token = await ERC20.new(totalSupply, "SomeToken", 18, "ST");
});
33 verbose node v8.11.2
34 verbose npm v5.6.0
35 error code 1
36 error Command failed: /usr/local/bin/git clone -q https://github.com/frozeman/bignumber.js-nolookahead.git /Users/t-whgri/.npm/_cacache/tmp/git-clone-1e15a942
36 error /Users/t-whgri/.npm/_cacache/tmp/git-clone-1e15a942/.git: Permission denied
37 verbose exit [ 1, true ]
Hey @frozeman
Since this is the version that is used in web3js I'm creating the issue in here.
I have the following case.
let dividend = new BigNumber(3000000000000000000);
let divisor = new BigNumber(3702000000000000000);
dividend.div(divisor).times(divisor).toString(10);
// "2999999999999999999.98416"
The result should be 3000000000000000000
There is also a different case doing the same calculation. The order of operations is reverted.
let dividend = new BigNumber(3000000000000000000);
let divisor = new BigNumber(3702000000000000000);
dividend.times(divisor).div(divisor).toString(10);
// "3000000000000000000"
The result is indeed 3000000000000000000
Theoretically the results shouldn't differ.
Hi,
Would it be possible to publish this package to npm?
I'm using web3js package, which in turn uses this package as a dependency, pointing directly to this repository, not an npm version.
This forces git to be installed on the CI machines and also gives no visibility on what code version is being used.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.