Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of `c`, `e`, and `s` in bignumber.js?

What are the meanings of the c, e, and s fields in the object produced by bignumber.js?

For example:

> new BigNumber('1234')
{ c: [1234], e: 3, s: 1 }
> new BigNumber('12345678901234567890')
{ c: [123456, 78901234567890], e: 19, s: 1 }
like image 693
David Wolever Avatar asked May 03 '18 21:05

David Wolever


People also ask

What is BigNumber in JS?

A BigNumber is an object which safely allows mathematical operations on numbers of any magnitude. Most operations which need to return a value will return a BigNumber and parameters which accept values will generally accept them.

Why would you use BigNumber library?

Why would we use bignumber library? is it because it also works with decimals? Yes. A bignumber library typically works with arbitrary-precision floating-point numbers, while a bigint library (or also the builtin data type) can only handle integers.

What is big number in solidity?

Values in memory on the EVM are in 256 bit (32 byte) words - BigNumber s in this library are considered to be consecutive words in big-endian order (top to bottom: word 0 - word n ). The struct BigNumber defined in ( src/interfaces/IBigNumber ) consists of the bytes value, the bit-length, and the sign of the value.


1 Answers

  • c | coefficient | number[]| Array of base 1e14 numbers
  • e | exponent | number | Integer, -1000000000 to 1000000000 inclusive
  • s | sign | number | -1 or 1
like image 65
euforic Avatar answered Sep 30 '22 06:09

euforic