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

Support arbitrarily big numbers (Big...) #451

Closed
64kramsystem opened this issue Oct 7, 2017 · 6 comments
Closed

Support arbitrarily big numbers (Big...) #451

64kramsystem opened this issue Oct 7, 2017 · 6 comments

Comments

@64kramsystem
Copy link
Member

Goby currently does support strictly integer representations (up to 64 bit), but not arbitrarily big numbers (typically called BigNum/BigInt...).

@st0012 if you don't have any very specific ideas about the implementation, I can implement Big numbers with a transparent Goby Integer interface - like Ruby 2.4 does, where an Integer is always exposed to the user, and transparently changed behind the scenes when required.

@hachi8833
Copy link
Member

I agree with it.
Well I just wonder if we need Numeric class that is inherited to Integer and Float after that.
Numeric can be almost empty.

@64kramsystem
Copy link
Member Author

I think in the long term, the Goby Numeric class will be very likely added/needed, but I don't think that right now it would have any functionality - unless somebody introduces it with a specific purpose.

(for reference, Goby does have a Numeric interface, but in Go, and it's hidden from the user; it's currently used to abstract floating point conversions)

@64kramsystem
Copy link
Member Author

With that in mind, of course, I don't think that adding it straight away would hurt, but it would need to be carefully designed to make sure it would change as little as possible in the future (if it would be chosen not to wait for it to be needed and to have clearer requirements).

@st0012
Copy link
Member

st0012 commented Oct 7, 2017

@saveriomiroddi @hachi8833 I think this is worth working, but it's priority should be low until we've reached certain version (like v0.4.0). Because we or test users will use this feature only if other fundamental features are provided.

@hachi8833
Copy link
Member

Just a memorandum.

I remember Decimal class can potentially treat arbitrary big num:

» a = "9999999999999999999999999999999999999999999999000000000000000000000000".to_d
#» 9999999999999999999999999999999999999999999999000000000000000000000000
» a.fraction
#» 9999999999999999999999999999999999999999999999000000000000000000000000/1

I wonder how to convert Integer and Decimal smoothly. Currently Decimal's toString() is truncated on 60th digits.

@ear7h
Copy link
Contributor

ear7h commented Apr 14, 2018

Closing this issue because Big numbers are supported by the Decimal class, thank you @hachi8833 . I'll open up a separate issue for those concerns...

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

No branches or pull requests

4 participants