Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"math"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	two := make([]float64, 12)
	flag := make([]int, 12)
	for i := 0; i < 12; i++ {
		two[i] = math.Pow(2.0, 7.0-float64(i))
	}
	for scanner.Scan() {
		n, _ := strconv.ParseFloat(scanner.Text(), 64)
		if n < 0 {
			break
		}
		for i := 0; i < 12; i++ {
			flag[i] = 0
			if n >= two[i] {
				n -= two[i]
				flag[i] = 1
			}
		}
		if n < 10e-10 {
			i := 0
			for i < 12 {
				fmt.Printf("%d", flag[i])
				if i == 7 {
					fmt.Printf(".")
				}
				i++
			}
			fmt.Printf("\n")
		} else {
			fmt.Println("NA")
		}
	}
}

Python: # Aizu Problem 0220: Binary Digit A Doctor Loved

import sys, math, os, struct

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")



while True:
    n = float(input())
    if n < 0:
        break
    pre = int(n)
    post = n - int(n)
    res = bin(pre)[2:].zfill(8) + '.'
    for k in range(4):
        post *= 2
        res += str(int(post))
        post -= int(post)
    if pre > 255 or post > 0:
        print("NA")
    else:
        print(res)
    #m = int(n * 16)
    #if n == m / 16. and m < 4096:
    #    res = ""
    #    for k in range(12):
    #        res += str(m % 2)
    #        m //= 2
    #        if k == 7:
    #            res += '.'
    #    print(res)
    #else:
    #    print("NA")

Python: while True:
    d= float(input())
    if d< 0: break
    a= bin(int(d))[2:]
    if len(a)> 8:
        print("NA")
    else:
        a= a.zfill(8)+"."
        b= d-int(d)
        for _ in range(4):
            b*= 2
            if int(b)>= 1:
                a= a+'1'
                b-= 1
            else:
                a= a+'0'
        a= a.ljust(13, '0')
        print("NA" if 1e-10 < b or len(a)> 13 else a)

Python: while 1:
    n = float(input())
    if n<0:break
    m=n-int(n)
    a=bin(int(n))[2:].zfill(8)+'.'
    for _ in range(4):
        m*=2
        if m>=1:
            a+='1'
            m-=1
        else: a+='0'
    print('NA' if m>1e-10 or 13<len(a) else a)

Python: 
d = dict()
for i in range(16):
    v = "{:04b}".format(i)
    k = i/16
    d[k] = v
    
while True:
    p = float(input())
    if p < 0:
        break
    
    i = int(p)
    f = p - i
    if f not in d:
        print("NA")
    else:
        print("{:08b}".format(i),end="")
        print(".",end="")
        print(d[f])

Python: def to_digit(f):
  u = int(f)
  d = f - u
  us = ""
  if u == 0:
    us = "0"
  cnt = 8
  while u:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    us += str(u % 2)
    u //= 2
  us += "0" * cnt
  us = us[::-1]

  ds = ""
  acc = 0.5
  cnt = 4
  while d:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    if acc >= d:
      d -= acc
      ds += "1"
      acc /= 2
    else:
      ds += "0"
      acc /= 2
  ds += "0" * cnt
  return (us, ds)

while True:
  f = float(input())
  if f < 0:
    break
  us, ds = to_digit(f)
  if us == "DAME":
    print("NA")
  else:
    print(us.zfill(8) + "." + ds.zfill(4))

Python: from decimal import Decimal

while 1:
    n = Decimal(input())
    if n < 0:break
    d1 = int(n)
    d2 = n - d1
    s1 = format(d1,'b').zfill(8)
    if len(s1) > 8:
        print('NA')
        continue
    r = str(s1) + '.'
    for i in range(4):
        spam = int(d2 * 2)
        r += str(spam)
        d2 = d2*2 - spam
    if d2 > 0:
        print('NA')
        continue
    print(r)

Python: # AOJ 0220 Binary Digit A Doctor Loved
# Python3 2018.6.23 bal4u

while 1:
	a, b = map(int, input().split('.'))
	if a < 0: break
	if a > 255:
		print("NA")
		continue
	sa = format(a, '08b')
	sb, s = '', str(b)
	k = 10**len(s)
	for i in range(4):
		b *= 2
		if b >= k: sb += '1'
		else: sb += '0'
		b %= k
	if b == 0: print(sa, '.', sb, sep='')
	else: print("NA")

Python: import sys
f = sys.stdin

while True:
    n = float(f.readline())
    if n < 0:
        break
    output = bin(int(n))[2:].zfill(8) + '.'

    decimal = n - int(n)
    for i in range(4):
        decimal *= 2
        if 1 <= decimal:
            decimal -= 1
            output += '1'
        else:
            output += '0'
            
    if 1e-10 < decimal or 13 < len(output):
        print('NA')
    else:
        print(output)

Python: # AOJ 0220 Binary Digit A Doctor Loved
# Python3 2018.6.23 bal4u

while 1:
	s = input()
	if s[0] == '-': break
	w = len(s)
	if s.find('.') < 0: a, b = int(s), 0
	elif w == 1: a, b = 0, 0
	elif s[0] == '.': a, b = 0, int(s[1:])
	else:
		if s[w-1] == '.': s += '0'
		a, b = map(int, s.split('.'))
	if a > 255:
		print("NA")
		continue
	sa = format(a, '08b')
	sb, s = '', str(b)
	k = 10**len(s)
	for i in range(4):
		b *= 2
		if b >= k: sb += '1'
		else: sb += '0'
		b %= k
	if b == 0: print(sa, '.', sb, sep='')
	else: print("NA")

Python: def ans(N): # N:foat
    n=int(N)
    d=N-n
    ans_l=bin(n)[2:]
    ans_r=''
    for _ in range(4):
        ans_r+=str(int(d*2))
        d=d*2-int(d*2)
    if n>=256 or d!=0:
        return 'NA'
    else:
        return '0'*(8-len(ans_l))+ans_l+'.'+ans_r

while True:
    INP=float(input())
    if INP<0: break
    print(ans(INP))

Python: def to_digit(f):
  u = int(f)
  d = f - u
  us = ""
  if u == 0:
    us = "0" * 8
  else:
    cnt = 8
    while u:
      if cnt == 0:
        return ("DAME", "DESU!!")
      cnt -= 1
      us += str(u % 2)
      u //= 2
    us += "0" * cnt
    us = us[::-1]

  ds = ""
  cnt = 4
  acc = 1
  while d > 0:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    acc /= 2
    if d >= acc:
      d -= acc
      ds += "1"
    else:
      ds += "0"
  ds += "0" * cnt
  return (us, ds)

while True:
  f = float(input())
  if f < 0:
    break
  us, ds = to_digit(f)
  if us == "DAME":
    print("NA")
  else:
    print(us, ds, sep=".")

Python: # AOJ 0220 Binary Digit A Doctor Loved
# Python3 2018.6.23 bal4u

while 1:
	s = input()
	if s[0] == '-': break
	if s.find('.') < 0: a, b = s, '0'
	else:
		a, b = s.split('.')
		if a == '': a = '0'
		if b == '': b = '0'
	k = 10**len(b)
	a, b = int(a), int(b)
	if a > 255:
		print("NA")
		continue
	sa = format(a, '08b')
	sb = ''
	for i in range(4):
		b *= 2
		if b >= k: sb += '1'
		else: sb += '0'
		b %= k
	if b == 0: print(sa, '.', sb, sep='')
	else: print("NA")

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0220

"""
import sys
from sys import stdin
input = stdin.readline


def solve(f):
    if f >= 256.0:
        return 'NA'
    f *= 16
    int_f = int(f)
    if f != int_f:
        return 'NA'
    bin_f = bin(int_f)[2:]
    fraction_p = bin_f[-4:]
    integer_p = bin_f[:-4]
    return integer_p.zfill(8) + '.' + fraction_p.zfill(4)


def main(args):
    while True:
        f = float(input())
        if f < 0.0:
            break
        result = solve(f)
        print(result)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: def to_digit(f):
  u = int(f)
  d = f - u
  us = ""
  if u == 0:
    us = "0"
  cnt = 8
  while u:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    us += str(u % 2)
    u //= 2
  us += "0" * cnt
  us = us[::-1]

  ds = ""
  cnt = 4
  acc = 1
  while d > 0:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    acc /= 2
    if d >= acc:
      d -= acc
      ds += "1"
    else:
      ds += "0"
  ds += "0" * cnt
  return (us, ds)

while True:
  f = float(input())
  if f < 0:
    break
  us, ds = to_digit(f)
  if us == "DAME":
    print("NA")
  else:
    print(us, ds, sep=".")

Python: while True:
    d= float(input())
    if d< 0: break
    a, b= bin(int(d))[2:].zfill(8)+".", d-int(d)
    while 1:
        b*= 2
        a= a+'1' if int(b)>= 1 else a+'0'
        if str(b).split(".")==['1','0']: break
        b-=int(b)
    a= a.ljust(13, '0')
    print("NA" if len(a)> 13 else a)