Commit 713efb16 authored by Phuengton Chummuel's avatar Phuengton Chummuel

add assingment week04

parent 425ffa8a
...@@ -8,7 +8,7 @@ def single_prec(v): ...@@ -8,7 +8,7 @@ def single_prec(v):
1, 8, 23 --> จำนวน bits 1, 8, 23 --> จำนวน bits
''' '''
print("IEEE single precision") print("IEEE single precision")
tmp_v = [0] * 64 tmp_v = [0] * 32
tmp_v = [int(v[i]) for i in range(len(v))] tmp_v = [int(v[i]) for i in range(len(v))]
sign = (-1) ** int(v[0]) sign = (-1) ** int(v[0])
...@@ -27,7 +27,7 @@ def double_prec(v): # Home Work ...@@ -27,7 +27,7 @@ def double_prec(v): # Home Work
0, 1-11, 9-63 --> ตำแหน่ง bit 0, 1-11, 9-63 --> ตำแหน่ง bit
1, 11, 52 --> จำนวน bits 1, 11, 52 --> จำนวน bits
''' '''
tmp_v = [0] * 32 tmp_v = [0] * 64
tmp_v = [int(v[i]) for i in range(len(v))] tmp_v = [int(v[i]) for i in range(len(v))]
print("IEEE double precision") print("IEEE double precision")
......
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