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

Documentation says u128 is maximum integer but in a codebase we have mentions of u256 #9454

Closed
achempion opened this issue Jul 25, 2021 · 3 comments

Comments

@achempion
Copy link

We have mentions of u256 but master documentation mentions only u128.

Also, we have bigint struct without any hints what it actually is and what maximum value it can represent, 300^40?

p.s. I don't have much experience in system programming

@tauoverpi
Copy link
Sponsor Contributor

There's a snippet below the table which covers the u256 case.

In addition to the integer types above, arbitrary bit-width integers can be referenced by using an identifier of i or u followed by digits. For example, the identifier i7 refers to a signed 7-bit integer. The maximum allowed bit-width of an integer type is 65535.

@achempion
Copy link
Author

Didn't see that, thank you for pointing out, just searched the page for "u256".

But what is bigint for? Isn't u65535 can cover most of the needs for big numbers?

@ifreund
Copy link
Member

ifreund commented Jul 25, 2021

But what is bigint for? Isn't u65535 can cover most of the needs for big numbers?

u65535 is big, but it's not arbitrarily big/small to fit your needs. The bigint implementation in the std is used to implement comptime_ints in the self hosted compiler.

@ifreund ifreund closed this as completed Jul 25, 2021
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

3 participants