Created
August 23, 2022 14:35
-
-
Save highfestiva/8ca53fd3407a59385cf8a7771fe30a06 to your computer and use it in GitHub Desktop.
Binary convert argument integers to doubles
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
#!/usr/bin/env python3 | |
import struct | |
import sys | |
for i in sys.argv[1:]: | |
i = int(i[2:], 16) if i.lower().startswith('0x') else int(i) | |
d = struct.unpack('!d', struct.pack('!Q', i))[0] | |
print(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment