How to deal with big numbers in javascript [duplicate]

Multi tool use
Multi tool use












20
















This question already has an answer here:




  • What is the standard solution in JavaScript for handling big numbers (BigNum)? [closed]

    2 answers




I'm looking for a Mathematical solution that deals with really (long, big, huge, storms) numbers. I haven't found anything yet, But I don't wanna think that this problem hasn't be solve at this time. I'm looking for an easy Number solution, like Microsoft Excel Precision (30 decimals), or a BigInteger (Java) solution. in Javascript of course.










share|improve this question













marked as duplicate by meagar, easwee, Sheridan, Filipe Gonçalves, Kamiel Wanrooij Mar 11 '14 at 13:08


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    See stackoverflow.com/questions/3072307/…

    – Crescent Fresh
    Nov 26 '10 at 22:20
















20
















This question already has an answer here:




  • What is the standard solution in JavaScript for handling big numbers (BigNum)? [closed]

    2 answers




I'm looking for a Mathematical solution that deals with really (long, big, huge, storms) numbers. I haven't found anything yet, But I don't wanna think that this problem hasn't be solve at this time. I'm looking for an easy Number solution, like Microsoft Excel Precision (30 decimals), or a BigInteger (Java) solution. in Javascript of course.










share|improve this question













marked as duplicate by meagar, easwee, Sheridan, Filipe Gonçalves, Kamiel Wanrooij Mar 11 '14 at 13:08


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    See stackoverflow.com/questions/3072307/…

    – Crescent Fresh
    Nov 26 '10 at 22:20














20












20








20


8







This question already has an answer here:




  • What is the standard solution in JavaScript for handling big numbers (BigNum)? [closed]

    2 answers




I'm looking for a Mathematical solution that deals with really (long, big, huge, storms) numbers. I haven't found anything yet, But I don't wanna think that this problem hasn't be solve at this time. I'm looking for an easy Number solution, like Microsoft Excel Precision (30 decimals), or a BigInteger (Java) solution. in Javascript of course.










share|improve this question















This question already has an answer here:




  • What is the standard solution in JavaScript for handling big numbers (BigNum)? [closed]

    2 answers




I'm looking for a Mathematical solution that deals with really (long, big, huge, storms) numbers. I haven't found anything yet, But I don't wanna think that this problem hasn't be solve at this time. I'm looking for an easy Number solution, like Microsoft Excel Precision (30 decimals), or a BigInteger (Java) solution. in Javascript of course.





This question already has an answer here:




  • What is the standard solution in JavaScript for handling big numbers (BigNum)? [closed]

    2 answers








javascript floating-point decimal biginteger bignum






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 26 '10 at 22:03









crsuarezfcrsuarezf

55311128




55311128




marked as duplicate by meagar, easwee, Sheridan, Filipe Gonçalves, Kamiel Wanrooij Mar 11 '14 at 13:08


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by meagar, easwee, Sheridan, Filipe Gonçalves, Kamiel Wanrooij Mar 11 '14 at 13:08


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    See stackoverflow.com/questions/3072307/…

    – Crescent Fresh
    Nov 26 '10 at 22:20














  • 1





    See stackoverflow.com/questions/3072307/…

    – Crescent Fresh
    Nov 26 '10 at 22:20








1




1





See stackoverflow.com/questions/3072307/…

– Crescent Fresh
Nov 26 '10 at 22:20





See stackoverflow.com/questions/3072307/…

– Crescent Fresh
Nov 26 '10 at 22:20












4 Answers
4






active

oldest

votes


















17














It looks like this has been solved before:



What is the standard solution in Javascript for handling big numbers (BigNum)?



http://jsfromhell.com/classes/bignumber



http://www-cs-students.stanford.edu/~tjw/jsbn/



If you only need integers you can use BigInteger.js.






share|improve this answer


























  • Thanks, this was exactly what i was looking for. well, the second link is the winner.

    – crsuarezf
    Nov 27 '10 at 3:39











  • the second is great. thanks.

    – ofir_aghai
    Oct 28 '18 at 9:36



















10














While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:



I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)




  • Comprehensive set of functions and fast


Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)




  • Comprehensive set of functions and pretty fast


  • BUT: Negative number representation is buggy!


bignumber.js (https://github.com/MikeMcl/bignumber.js)




  • Pretty complete set of functions


  • BUT: Converting really big numbers from strings into BigNumber objects result in INFINITY


Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)




  • JS-Implementation of Scheme arithmetic functions


  • BUT: No function for y= x^e mod n


I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)




  • Functions for high precision claculations


  • BUT: It's said to be slow due to internal representation of numbers as strings






share|improve this answer
























  • Does the "BUT" for bignumber.js still hold true - is there an issue about this?

    – Olga
    Nov 30 '15 at 15:21



















3














There's a BigInteger library for JavaScript available here:




  • jsbn.js


(Note that I haven't used this myself. Try it and see what you think.)






share|improve this answer
























  • +1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

    – T.J. Crowder
    Nov 26 '10 at 22:18











  • @TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

    – Pointy
    Nov 26 '10 at 22:21













  • Thanks, it would be great, if it just was a little more easy to understand and extend from.

    – crsuarezf
    Nov 27 '10 at 3:38



















0














There is also Silent Matt's library for Big Integers. It does not handle decimals.






share|improve this answer
























  • Sorry, but I'was looking for one that manage specially that kind of numbers. :)

    – crsuarezf
    Dec 14 '10 at 21:34


















4 Answers
4






active

oldest

votes








4 Answers
4






active

oldest

votes









active

oldest

votes






active

oldest

votes









17














It looks like this has been solved before:



What is the standard solution in Javascript for handling big numbers (BigNum)?



http://jsfromhell.com/classes/bignumber



http://www-cs-students.stanford.edu/~tjw/jsbn/



If you only need integers you can use BigInteger.js.






share|improve this answer


























  • Thanks, this was exactly what i was looking for. well, the second link is the winner.

    – crsuarezf
    Nov 27 '10 at 3:39











  • the second is great. thanks.

    – ofir_aghai
    Oct 28 '18 at 9:36
















17














It looks like this has been solved before:



What is the standard solution in Javascript for handling big numbers (BigNum)?



http://jsfromhell.com/classes/bignumber



http://www-cs-students.stanford.edu/~tjw/jsbn/



If you only need integers you can use BigInteger.js.






share|improve this answer


























  • Thanks, this was exactly what i was looking for. well, the second link is the winner.

    – crsuarezf
    Nov 27 '10 at 3:39











  • the second is great. thanks.

    – ofir_aghai
    Oct 28 '18 at 9:36














17












17








17







It looks like this has been solved before:



What is the standard solution in Javascript for handling big numbers (BigNum)?



http://jsfromhell.com/classes/bignumber



http://www-cs-students.stanford.edu/~tjw/jsbn/



If you only need integers you can use BigInteger.js.






share|improve this answer















It looks like this has been solved before:



What is the standard solution in Javascript for handling big numbers (BigNum)?



http://jsfromhell.com/classes/bignumber



http://www-cs-students.stanford.edu/~tjw/jsbn/



If you only need integers you can use BigInteger.js.







share|improve this answer














share|improve this answer



share|improve this answer








edited May 23 '17 at 12:19









Community

11




11










answered Nov 26 '10 at 22:07









xscottxscott

2,0691217




2,0691217













  • Thanks, this was exactly what i was looking for. well, the second link is the winner.

    – crsuarezf
    Nov 27 '10 at 3:39











  • the second is great. thanks.

    – ofir_aghai
    Oct 28 '18 at 9:36



















  • Thanks, this was exactly what i was looking for. well, the second link is the winner.

    – crsuarezf
    Nov 27 '10 at 3:39











  • the second is great. thanks.

    – ofir_aghai
    Oct 28 '18 at 9:36

















Thanks, this was exactly what i was looking for. well, the second link is the winner.

– crsuarezf
Nov 27 '10 at 3:39





Thanks, this was exactly what i was looking for. well, the second link is the winner.

– crsuarezf
Nov 27 '10 at 3:39













the second is great. thanks.

– ofir_aghai
Oct 28 '18 at 9:36





the second is great. thanks.

– ofir_aghai
Oct 28 '18 at 9:36













10














While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:



I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)




  • Comprehensive set of functions and fast


Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)




  • Comprehensive set of functions and pretty fast


  • BUT: Negative number representation is buggy!


bignumber.js (https://github.com/MikeMcl/bignumber.js)




  • Pretty complete set of functions


  • BUT: Converting really big numbers from strings into BigNumber objects result in INFINITY


Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)




  • JS-Implementation of Scheme arithmetic functions


  • BUT: No function for y= x^e mod n


I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)




  • Functions for high precision claculations


  • BUT: It's said to be slow due to internal representation of numbers as strings






share|improve this answer
























  • Does the "BUT" for bignumber.js still hold true - is there an issue about this?

    – Olga
    Nov 30 '15 at 15:21
















10














While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:



I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)




  • Comprehensive set of functions and fast


Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)




  • Comprehensive set of functions and pretty fast


  • BUT: Negative number representation is buggy!


bignumber.js (https://github.com/MikeMcl/bignumber.js)




  • Pretty complete set of functions


  • BUT: Converting really big numbers from strings into BigNumber objects result in INFINITY


Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)




  • JS-Implementation of Scheme arithmetic functions


  • BUT: No function for y= x^e mod n


I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)




  • Functions for high precision claculations


  • BUT: It's said to be slow due to internal representation of numbers as strings






share|improve this answer
























  • Does the "BUT" for bignumber.js still hold true - is there an issue about this?

    – Olga
    Nov 30 '15 at 15:21














10












10








10







While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:



I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)




  • Comprehensive set of functions and fast


Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)




  • Comprehensive set of functions and pretty fast


  • BUT: Negative number representation is buggy!


bignumber.js (https://github.com/MikeMcl/bignumber.js)




  • Pretty complete set of functions


  • BUT: Converting really big numbers from strings into BigNumber objects result in INFINITY


Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)




  • JS-Implementation of Scheme arithmetic functions


  • BUT: No function for y= x^e mod n


I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)




  • Functions for high precision claculations


  • BUT: It's said to be slow due to internal representation of numbers as strings






share|improve this answer













While looking for an big integer library for an ElGamal crypto implementation I tested several libraries with the following results:



I recommend this one: Tom Wu's jsbn.js (http://www-cs-students.stanford.edu/~tjw/jsbn/)




  • Comprehensive set of functions and fast


Leemon Baird's big integer library (http://www.leemon.com/crypto/BigInt.js)




  • Comprehensive set of functions and pretty fast


  • BUT: Negative number representation is buggy!


bignumber.js (https://github.com/MikeMcl/bignumber.js)




  • Pretty complete set of functions


  • BUT: Converting really big numbers from strings into BigNumber objects result in INFINITY


Scheme arithmetic library for JavaScript (https://github.com/jtobey/javascript-bignum)




  • JS-Implementation of Scheme arithmetic functions


  • BUT: No function for y= x^e mod n


I haven't tested this by myself: BigNumber (http://jsfromhell.com/classes/bignumber)




  • Functions for high precision claculations


  • BUT: It's said to be slow due to internal representation of numbers as strings







share|improve this answer












share|improve this answer



share|improve this answer










answered Jun 11 '13 at 15:01









TorbenTorben

4,23112623




4,23112623













  • Does the "BUT" for bignumber.js still hold true - is there an issue about this?

    – Olga
    Nov 30 '15 at 15:21



















  • Does the "BUT" for bignumber.js still hold true - is there an issue about this?

    – Olga
    Nov 30 '15 at 15:21

















Does the "BUT" for bignumber.js still hold true - is there an issue about this?

– Olga
Nov 30 '15 at 15:21





Does the "BUT" for bignumber.js still hold true - is there an issue about this?

– Olga
Nov 30 '15 at 15:21











3














There's a BigInteger library for JavaScript available here:




  • jsbn.js


(Note that I haven't used this myself. Try it and see what you think.)






share|improve this answer
























  • +1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

    – T.J. Crowder
    Nov 26 '10 at 22:18











  • @TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

    – Pointy
    Nov 26 '10 at 22:21













  • Thanks, it would be great, if it just was a little more easy to understand and extend from.

    – crsuarezf
    Nov 27 '10 at 3:38
















3














There's a BigInteger library for JavaScript available here:




  • jsbn.js


(Note that I haven't used this myself. Try it and see what you think.)






share|improve this answer
























  • +1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

    – T.J. Crowder
    Nov 26 '10 at 22:18











  • @TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

    – Pointy
    Nov 26 '10 at 22:21













  • Thanks, it would be great, if it just was a little more easy to understand and extend from.

    – crsuarezf
    Nov 27 '10 at 3:38














3












3








3







There's a BigInteger library for JavaScript available here:




  • jsbn.js


(Note that I haven't used this myself. Try it and see what you think.)






share|improve this answer













There's a BigInteger library for JavaScript available here:




  • jsbn.js


(Note that I haven't used this myself. Try it and see what you think.)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 26 '10 at 22:06









LukeHLukeH

205k44305381




205k44305381













  • +1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

    – T.J. Crowder
    Nov 26 '10 at 22:18











  • @TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

    – Pointy
    Nov 26 '10 at 22:21













  • Thanks, it would be great, if it just was a little more easy to understand and extend from.

    – crsuarezf
    Nov 27 '10 at 3:38



















  • +1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

    – T.J. Crowder
    Nov 26 '10 at 22:18











  • @TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

    – Pointy
    Nov 26 '10 at 22:21













  • Thanks, it would be great, if it just was a little more easy to understand and extend from.

    – crsuarezf
    Nov 27 '10 at 3:38

















+1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

– T.J. Crowder
Nov 26 '10 at 22:18





+1 for an answer, but wow that script needs refactoring. Completely unnecessary global symbols all over the place, just asking for collisions.

– T.J. Crowder
Nov 26 '10 at 22:18













@TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

– Pointy
Nov 26 '10 at 22:21







@TJ I think that one's a more-or-less direct translation of the Java BigDecimal class ... it's been around forever

– Pointy
Nov 26 '10 at 22:21















Thanks, it would be great, if it just was a little more easy to understand and extend from.

– crsuarezf
Nov 27 '10 at 3:38





Thanks, it would be great, if it just was a little more easy to understand and extend from.

– crsuarezf
Nov 27 '10 at 3:38











0














There is also Silent Matt's library for Big Integers. It does not handle decimals.






share|improve this answer
























  • Sorry, but I'was looking for one that manage specially that kind of numbers. :)

    – crsuarezf
    Dec 14 '10 at 21:34
















0














There is also Silent Matt's library for Big Integers. It does not handle decimals.






share|improve this answer
























  • Sorry, but I'was looking for one that manage specially that kind of numbers. :)

    – crsuarezf
    Dec 14 '10 at 21:34














0












0








0







There is also Silent Matt's library for Big Integers. It does not handle decimals.






share|improve this answer













There is also Silent Matt's library for Big Integers. It does not handle decimals.







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 14 '10 at 21:18









Jérôme VerstryngeJérôme Verstrynge

28.1k64219389




28.1k64219389













  • Sorry, but I'was looking for one that manage specially that kind of numbers. :)

    – crsuarezf
    Dec 14 '10 at 21:34



















  • Sorry, but I'was looking for one that manage specially that kind of numbers. :)

    – crsuarezf
    Dec 14 '10 at 21:34

















Sorry, but I'was looking for one that manage specially that kind of numbers. :)

– crsuarezf
Dec 14 '10 at 21:34





Sorry, but I'was looking for one that manage specially that kind of numbers. :)

– crsuarezf
Dec 14 '10 at 21:34



ctlxnPx4QsQ
ILrTGT0,vG2ZsK UCjqXS4 K 3OfhEuK

Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas