Created
October 2, 2020 03:29
-
-
Save jwasinger/2b7950e5b29ac42c44228a286bb8c069 to your computer and use it in GitHub Desktop.
C++ vs Python (uint128)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <iostream> | |
int main(int argc, char **argv) { | |
uint64_t x = 12823323627408599439; | |
uint64_t y = 5504717096808338412; | |
__uint128_t res = (__uint128_t)x * y; | |
std::cout << x << " * " << y << " = " << (uint64_t)res << ", " << (uint64_t)(res >> 64) << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 12823323627408599439 | |
y = 5504717096808338412 | |
print(x, " * ", y, " = ", x * y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment