开发者

How to get completely accurate values in JavaScript? [duplicate]

开发者 https://www.devze.com 2023-03-25 01:31 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: Huge Integer JavaScript Library
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Huge Integer JavaScript Library

Suppose I want the exact value for 2^1000. How am I supposed to get the entire value? Maybe storing it in a string every time the multiplication is done, but it will still eventually go over 10 digits! Is there any way, or开发者_JS百科 does ECMAScript just not support this?


Math.pow(2,1000)

returns

1.0715086071862673e+301

how accurate do you need this to be?

0

精彩评论

暂无评论...
验证码 换一张
取 消