Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proper BigNum support #96

Open
alexandrosm opened this issue Nov 28, 2014 · 7 comments
Open

proper BigNum support #96

alexandrosm opened this issue Nov 28, 2014 · 7 comments
Labels

Comments

@alexandrosm
Copy link

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?

@BrianTMaurer
Copy link

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.

@alexandrosm
Copy link
Author

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
#96 (comment).

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.

@alongubkin
Copy link
Owner

Do you have any proposal for "big operators"?

Also, let's consider using normal operators. How slow is this compared to basic arithmetic?

@alexandrosm
Copy link
Author

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
#96 (comment).

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.

@Namek
Copy link
Collaborator

Namek commented Nov 30, 2014

Macros would fit here. No built-in bigint types but using external library then.

@nmn
Copy link

nmn commented Dec 1, 2014

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.

@Namek
Copy link
Collaborator

Namek commented Dec 3, 2014

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants