proper BigNum support
one thing I always hate about doing project euler type projects in js is its terrible support for big integers and big decimals. There are libraries like
https://github.com/justmoon/node-bignum https://github.com/substack/node-bigint https://github.com/MikeMcl/big.js/
but obviously not having native support makes them look and feel terrible. I fully understand if you feel this is an issue for a different day and close this, no hard feelings, but if we're thinking about fixing javascript's warts, its behaviour for big integers/decimals is definitely a terrible painpoint no compile-to-js language (I know of) has looked at fixing.
This doesn't mean altering the semantics of basic arithmetic, but perhaps a set of "big" operators could sort this out?
I think this should be changed to "Proper Arbitrary Precision Decimal Support" Bignum support is just one option. Here is another library with arbitrary precision decimal support. https://github.com/MikeMcl/decimal.js.
agreed
On Fri, Nov 28, 2014 at 5:39 PM, Brian T Maurer [email protected] wrote:
I think this should be changed to "Proper Arbitrary Precision Decimal Support" Bignum support is just one option. Here is another library with arbitrary precision decimal support. https://github.com/MikeMcl/decimal.js
— Reply to this email directly or view it on GitHub https://github.com/alongubkin/spider/issues/96#issuecomment-64938020.
Alexandros Marinos
Founder / Director, Rulemotion Ltd
tel:
+44 1483 68 8333
Surrey Technology Centre, 40 Occam Road
mob:
+44 7534 212 892
Surrey Research Park
twt:
@alexandrosm https://twitter.com/#!/alexandrosm
Guildford GU2 7YG, UK
Rulemotion Ltd is a limited company registered in England and Wales. Company Registration No. 07794151. Registered Offices: 40 Occam Road, Surrey Technology Centre, Surrey Research Park, Guildford, Surrey, GU2 7YG, England.
IMPORTANT: This message from Rulemotion Ltd is private and confidential. If you have received the message in error, please notify us and remove it from your system.
Do you have any proposal for "big operators"?
Also, let's consider using normal operators. How slow is this compared to basic arithmetic?
I guess slower than native arithmetic (unless some crazy person has gone and done asm.js magic or sth) though we'd need good benchmarks for this that don't exist. I guess my point is, if there were special operators that took the python approach and used the right data structure for the size of the result, this could be used by anyone who cares, and everyone else can keep using normal arithmetic. E.g. the operators could pair up the normal arithmetic (+-*/) with some fairly rare symbol to create the new operators such that they would not interfere with day-to-day tasks.
On Sat, Nov 29, 2014 at 1:36 AM, Alon Gubkin [email protected] wrote:
How slow is this compared to basic arithmetic?
— Reply to this email directly or view it on GitHub https://github.com/alongubkin/spider/issues/96#issuecomment-64946544.
Alexandros Marinos
Founder / Director, Rulemotion Ltd
tel:
+44 1483 68 8333
Surrey Technology Centre, 40 Occam Road
mob:
+44 7534 212 892
Surrey Research Park
twt:
@alexandrosm https://twitter.com/#!/alexandrosm
Guildford GU2 7YG, UK
Rulemotion Ltd is a limited company registered in England and Wales. Company Registration No. 07794151. Registered Offices: 40 Occam Road, Surrey Technology Centre, Surrey Research Park, Guildford, Surrey, GU2 7YG, England.
IMPORTANT: This message from Rulemotion Ltd is private and confidential. If you have received the message in error, please notify us and remove it from your system.
Macros would fit here. No built-in bigint types but using external library then.
Without native Javascript support, I don't see a way this can be done in a good way. Also, we should hold off on adding too many features too quickly to spider. Feature bloat will come back to bite us when ES7 is on the horizon with BigNum support.
I see a rare usage of big integers generally. Most of software doesn't need that. There are languages like Haskell which support that internally. That feature is mostly used in scientific usage, where high performance is needed as well. Such performance can't be probably achieved using JavaScript / ES.