6

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 }
Bergi
  • 630,263
  • 148
  • 957
  • 1,375
David Wolever
  • 148,955
  • 89
  • 346
  • 502
  • 2
    They are well-documented on bignumber.js's [github page](https://github.com/MikeMcl/bignumber.js/). – Sam Axe May 03 '18 at 21:11
  • I'm voting to close this question as off-topic because no research was done. – Sam Axe May 03 '18 at 21:12
  • Looks like you mixed up the outputs? – Bergi May 03 '18 at 21:14
  • 3
    @SamAxe that's not actually a close reason. – John Dvorak May 03 '18 at 21:14
  • 1
    Ah okay, now that I know the answer, it's easy to search for "coefficient" in the docs. Without knowing that, though, it's not especially straight forward to search for, and google came up with nothing (except someone else asking the same question somewhere else, without an answer). – David Wolever May 03 '18 at 21:15
  • 1
    @JohnDvorak: sure it is. You'll notice I was able to apply it to my close vote. – Sam Axe May 03 '18 at 21:16
  • 2
    @SamAxe I mean, it's not a _valid_ close reason. That would be "duplicate", if that applies to this question. – John Dvorak May 03 '18 at 21:26
  • @JohnDvorak: Today it appears to be a valid reason. – Sam Axe May 03 '18 at 21:28
  • i think this question is valid. first i found via google from github was https://mikemcl.github.io/bignumber.js/ but didn't answer the question. what it is more, there are more repos than github. thanks to this open question I could find the solution, so I find it useful and quite straightforward. It saved me time, and thus have my positive vote. – José Crespo Barrios Dec 11 '20 at 17:19

1 Answers1

7
  • c | coefficient | number[]| Array of base 1e14 numbers
  • e | exponent | number | Integer, -1000000000 to 1000000000 inclusive
  • s | sign | number | -1 or 1
euforic
  • 86
  • 1