When I convert a variable using the functions toNumber() or toString() I obtain this result: x.toNumber()


But I want to see the entire number with all the figures. Because If I don´t convert the number, the big number format it´s something like this:

BigNumber { s: 1, e: 26, c: [ 9999999500000 ] }

Try this. I'm assuming you're fetching a response from a contract.

var theNumber;
.then(function(response) {
  theNumber = response;

You can lower the magnitude with fromWei(theNumber, 'unit'). Something like

var shift18;
  shift18 = fromWei(theNumber, 'ether'); // (18 decimals)

Hope it helps.

| improve this answer | |

Try this:

var value = new BigNumber(resultis.args._amount);

//converting the bignumber from wei to ether, 18 decimal, replace trailing zero

var value = (web3.fromWei(value, "ether").toFixed(18)).replace(/^0+(\d)|(\d)0+$/gm, '$1$2');

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.