Click here to Skip to main content
15,885,668 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to display large integers in Javascript?

On fetching its displayed as 2.344444555e+3455. Its not displayed properly. With characters and numbers there is no issue.
Posted
Comments
jgakenhe 7-May-15 16:43pm    
Since you are just displaying it, why not convert it to a string? That is what I'd do. Seems like JavaScript numbers are floating point to 15 digits; so I believe that is all you can do.
Sergey Alexandrovich Kryukov 7-May-15 18:16pm    
Not clear. How it should be displayed and how it is actually displayed? What's the problem? What are the mantissa and order limits you want to have?
—SA

1 solution

JavaScript does not support so big integers. If you enter the assignment to such literal in JavaScript, it will be parsed to Infinity.

One of the possible work-around solution would be using a BigInteger library for JavaScript. Consider, for example, this: http://silentmatt.com/biginteger[^].

See also: http://www.leemon.com/crypto/BigInt.html[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900