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

Rationale for reducing u240 to u120 #30

Open
GalloDaSballo opened this issue Oct 15, 2024 · 0 comments
Open

Rationale for reducing u240 to u120 #30

GalloDaSballo opened this issue Oct 15, 2024 · 0 comments

Comments

@GalloDaSballo
Copy link
Collaborator

type(uint120).max
Type: uint120
├ Hex: 0xffffffffffffffffffffffffffffff
├ Hex (full word): 0x0000000000000000000000000000000000ffffffffffffffffffffffffffffff
└ Decimal: 1329227995784915872903807060280344575uint256(type(uint32).max) * uint256(type(uint88).max)
Type: uint256
├ Hex: 0x0000000000000000000000000000000000fffffffeffffffffffffff00000001
├ Hex (full word): 0x0000000000000000000000000000000000fffffffeffffffffffffff00000001
└ Decimal: 1329227995475430863082461987260596225
>>> (2**88-1)*(2**32-1)
1329227995475430863082461987260596225
>>> 1329227995784915872903807060280344576 - 1329227995475430863082461987260596225
309485009821345073019748351
>>> hex(1329227995784915872903807060280344576)
'0x1000000000000000000000000000000'
>>> hex(1329227995475430863082461987260596225)
'0xfffffffeffffffffffffff00000001'
>>> 2**120-1
1329227995784915872903807060280344575
>>> hex(1329227995784915872903807060280344575)
'0xffffffffffffffffffffffffffffff'

Meaning we can represent the values safely (until 2106)

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

1 participant