From 595fa03718fd70be1c6064e48492e5bdf5cd5e86 Mon Sep 17 00:00:00 2001 From: Thomas Coppi Date: Thu, 11 Oct 2007 22:35:40 -0600 Subject: [PATCH] Add a module that shows the hexadecimal bitfield of a floating point number --- modules/float.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 modules/float.py diff --git a/modules/float.py b/modules/float.py new file mode 100644 index 0000000..962709b --- /dev/null +++ b/modules/float.py @@ -0,0 +1,22 @@ +#Module for scrappy that implements floating-point functions + +import sys +import struct +import binascii + +def __init__(scrap): + #register commands + scrap.register_msg_event(float_cmd) + +def float_cmd(c,list,bot): + """""" + + cmd = list[4].split(" ")[0] + + if cmd == "$" and list[4].split(" ")[1]: + num = float(list[4].split(" ")[1]); + + tmp = struct.pack("!f", num) + + c.privmsg(list[5],binascii.hexlify(tmp)) + -- 2.11.4.GIT