Commit 3cfd0937 authored by Kittipong Maneewong's avatar Kittipong Maneewong

ส่งงาน week04

parent 7a70b30b
def single_prec(v): def single_prec(v):
v+"0"*(32-len(v))
return ((-1) ** int(v[0])) * sum([int(v[i]) * (2 ** (8 - i)) for i in range(1,32)]) return ((-1) ** int(v[0])) * sum([int(v[i]) * (2 ** (8 - i)) for i in range(1,32)])
def double_prec(v): def double_prec(v):
v + "0" * (64 - len(v))
return ((-1) ** int(v[0])) * sum([int(v[i]) * (2 ** (11 - i)) for i in range(1, 64)]) return ((-1) ** int(v[0])) * sum([int(v[i]) * (2 ** (11 - i)) for i in range(1, 64)])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment