aboutsummaryrefslogtreecommitdiff
path: root/semestr-3/anm/numerki/lista1/test.jl.txt
blob: 81b4901273c5b732e92611dd165a6458e743b609 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function string_to_float64(st)
  s = st[1]
  c = st[2:12]
  m = st[13:end]

  if s == '0'
      s = 1.0
  else
      s = -1.0
  end
  
  c = parse(Int, string("0b", c))
  c = 2.0 ^ (c - 1023)
  m = Float64(parse(Int64, string("0b", m))) / Float64(2^52) + 1.0
  return s * c * m
end