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

Numbers larger than int128? #13

Open
gregcman opened this issue May 4, 2019 · 2 comments
Open

Numbers larger than int128? #13

gregcman opened this issue May 4, 2019 · 2 comments

Comments

@gregcman
Copy link

gregcman commented May 4, 2019

(conspack:encode (1- (ash 1 128))) works,
but
(conspack:encode (ash 1 128)) fails.
Can cl-conspack support larger numbers?

@rpav
Copy link
Member

rpav commented May 8, 2019

There is bitspace for bignums I think, but they're not in the spec and not implemented.

This is not something I can do right now either, but if you want to figure it out and submit a PR let me know. The way things are looking, what you would want to do is use the #xE byte (let's call it "extended numbers" and leave #xD for long double), follow it by a new byte that looks like:

00xxxxnn

Leave the top two reserved, xxxx can be a new 4 type bits, and nn are size-encoding for stuff like bignum. However you'd encode it, it should be portable and easy to decode into any bignum system.

@gregcman
Copy link
Author

gregcman commented May 9, 2019

How's this for an encoding?
https://en.wikipedia.org/wiki/Variable-length_quantity
So #xE then 001011nn then variable-length-quantity-bytes
xxxx = #b1011 = #xB = "B" for "Bignum"

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

No branches or pull requests

2 participants