Files
lab/ds/25-1/1e/test.py
2025-12-15 18:53:54 +03:00

17 lines
434 B
Python

U8_MAX = 0xFFFFFFFFFFFFFFFF
U16_MAX = U8_MAX << 64 | U8_MAX
U32_MAX = U16_MAX << 128 | U16_MAX
def dothex(num):
strhex = hex(num)[2:]
dothex = strhex[-16:]
strhex = strhex[:-16]
while len(strhex) > 0:
dothex = strhex[-16:] + '.' + dothex
strhex = strhex[:-16]
return '0x' + dothex
print('mul16', dothex(U16_MAX * 2 % (U16_MAX + 1)))
print('mul32', dothex(U32_MAX * U16_MAX % (U32_MAX + 1)))