Commit dbe13399 authored by pattaraporn's avatar pattaraporn

ส่งงานค่ะ

parent 12f55868
print('hello world')
# cookiecutter .....
print("we' ve done it.")
This diff is collapsed.
def value (v,pos=4,ne=3):
sign = -1 if v[0]==1 else 1
return sign*sum([v[i]*2**(pos-i) for i in range(1,(pos+ne)+1)] )
print( value(v,4,3) )
def values(v, pos, ne):
aa=list(map(int,v))
sign = -1 if aa[0] == 1 else 1
return sign * sum([aa[i] * 2 ** (pos - i) for i in range(1, (pos + ne) + 1)])
def single_prec(v):
return (-1)**int(v[0])*sum([int(v[i])*2**(8-i) for i in range(1,23)])
def double_prec(v):
return (-1)**int(v[0])*sum([int(v[i])*2**(11-i) for i in range(1,23)])
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