MikeMcl / bignumber.js

A JavaScript library for arbitrary-precision decimal and non-decimal arithmetic
http://mikemcl.github.io/bignumber.js
MIT License
6.69k stars 742 forks source link

How to get decimal parts of a number? #196

Closed vschst closed 6 years ago

vschst commented 6 years ago

For example, I have a big number:

const str = "0.221410676794694825"
const number = new BigNumber(str)

I need to get an array of two elements - an integer part and a decimal, that is: ["0", "221410676794694825"]. Is there such a possibility in your library?

arguiot commented 6 years ago

You can do number.toString().split(".")

vschst commented 6 years ago

Thank you, useful thing. Can be closed issue.