Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

JavaScript : How to sum numbers , that is very big

Share this post!
 Vote this!

In Javascript Maximum Integer Value is 2^53, for example I want to sum two numbers which is more than 2^53 what can I do?

let's think. for example we have 1234+45 how can i sum this numbers? we can make this:

let's fill with zeros a free space. a=1234 and b=45
1234
0045
.......
1279


In JS we could write 1234 and 45 as a string. than we could use Arrays to write each nombers to our array.
for example: A[0]=4, A[1]=3, A[2]=2, A[3]=1
B[0]=5, B[1]=4 but what is B[2] we should fill this with a zero. i'll shou you how to do this in a script.  more...

0 comments:

Post a Comment