Skip to content

Instantly share code, notes, and snippets.

@highfestiva
Created August 23, 2022 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save highfestiva/8ca53fd3407a59385cf8a7771fe30a06 to your computer and use it in GitHub Desktop.
Save highfestiva/8ca53fd3407a59385cf8a7771fe30a06 to your computer and use it in GitHub Desktop.
Binary convert argument integers to doubles
#!/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