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: # coding: utf-8
# Your code here!

while True:
    N = input()
    if N.find(".") < 0:
        N = N + ".0"
    
    strA,strB = N.split(".")
    a = int(strA)
    if strA[0] == "-":
        break
    b = int(strB) * (10 ** (4-len(strB)))

    s1 = ""
    s2 = ""
    for i in range(8):
        if a > 0:
            s1 = str(a % 2) + s1
            a = a // 2
        else:
            s1 = "0" + s1
    
    for i in range(4):
        if b > 0:
            s2 = s2 + str((b * 2) // 10000) 
            b = (b * 2) % 10000
        else:
            s2 = s2 + "0"

    if a == 0 and b == 0:
        print(s1 + "." + s2)
    else:
        print("NA")

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
  while d > 0:
    if cnt == 0:
      return ("DAME", "DESU!!")
    cnt -= 1
    d *= 2
    if d >= 1:
      d -= 1
      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.zfill(8) + "." + ds.zfill(4))

Python: while True:
    d= float(input())
    if d< 0: break
    a, b= bin(int(d))[2:].zfill(8)+".", d-int(d)
    for _ in range(4):
        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)

Python: while True:
    d= float(input())
    if d< 0: break
    a, b= int(d), d-int(d)
    x, y=[], []
    while a> 0:
        x.append(a%2)
        a= a//2
    if len(x)< 8:
        x.append((8-len(x))*"0")
    else:
        print("NA")
        continue
    while int(b)!=1:
        y.append(int(b*2))
        b= b*2
    if len(y)< 4:
        y.append((4-len(y))*"0")
        y.insert(0, '.')
        z= x[::-1]+y
        print(''.join(map(str, z)))
    else:
        print("NA")

Python: while(True):
    n = float(input())
    if n < 0: break
    if int(n*16)-n*16: print("NA"); continue
    else:
        s = bin(int(n*16))[2:].zfill(12)
        print(s[:-4]+"."+s[-4:])

C++: #include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;
  
int main(){

    double a,c,i;
    int b,e;
    while(cin >> a){
        if(a < 0){break;}
        string ans[2] = {"",""},aa;
        b = a;
        c  = a - b;
        int co[2] = {0,0},check = 0;
        while(b > 0){
            if(b % 2 == 1){
                ans[0] = "1" + ans[0];
            }else{
                ans[0] = "0" + ans[0];
            }
            b = b / 2;
            co[0]++;

            if(co[0] > 8){check = 1;break;}
        }
        for(int i = co[0];7 >= i;i++){
            ans[0] = "0" + ans[0];
        }
        while(c != 0){
            c = c * 2;
            
            if(c >= 1){
                ans[1] = ans[1] + "1";
                co[1]++;
                if(co[1] > 4){check = 1;break;}
                if(c == 1){break;}
                c = c - 1;
            }else{
                ans[1] = ans[1] + "0";
                co[1]++;
                if(co[1] > 4){check = 1;break;}
            }
            
        }
        for(int i = co[1];3 >= i;i++){
            ans[1] = ans[1] + "0";
        }        
        if(check == 1){
            cout << "NA" << endl;
        }else{
        cout << ans[0] << "." << ans[1] << endl;
    }
    }
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <complex>
using namespace std;

typedef long long ll;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

int main(){
  double a;

  while(cin>>a,a!=-1){
    int left = (int)(a);
    double right = a - left;

    string s = "";
    while(left != 0){
      s = (char)(left % 2 + '0') + s;
      left /= 2;
      if(s.length() > 8) break;
    }

    string ss = "";
    while(right != 0){
      int tmp = (int)(right * 2);
      ss += (char)(tmp + '0');
      right = right * 2 - tmp;
      if(ss.length() > 4) break;
    }

    if(s.length() > 8 || ss.length() > 4){
      cout<<"NA\n";
    }
    else{
      while(s.length() != 8) s = '0' + s;
      while(ss.length() != 4) ss += '0';
      cout<<s<<"."<<ss<<endl;
    }
  }
}

C++: #include <cstdio>
#include <cmath>
#include <string>

using namespace std;

const double EPS=1e-9;

int main()
{
	for(char buf[1024];fgets(buf,1024,stdin),buf[0]!='-';){
		double x; sscanf(buf,"%lf",&x);
		x/=256;
		
		if(x>=1){
			puts("NA");
			continue;
		}
		string s(12,'0');
		for(int i=0;i<12;i++){
			x*=2;
			if(x>=1){
				s[i]++;
				x-=1;
			}
		}
		if(x!=0){
			puts("NA");
			continue;
		}
		
		for(int i=0;i<8;i++)
			putchar(s[i]);
		putchar('.');
		for(int i=0;i<4;i++)
			putchar(s[8+i]);
		putchar('\n');
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<utility>
#define EPS 0.000001
using namespace std;

double n;

int I;

double D;

int integer[8];
int decimal[4];


bool judge(double a){
	return (a - (int)a < EPS);
}


int Ifunction(int I,int l)
{
	int i = 7;

	int cnt = 0;

	while (I != 0)
	{
		
		if (cnt>=l)
		{
			return 0;
		}

		integer[i--] = I % 2;

		I = I / 2;

		cnt++;
	}
}

void DIfunction(int I,int a)
{
	int i = a-1;

	while (I!=0)
	{
		decimal[i++] = I % 2;

		I = I / 2;
	}
}

void D2function(double D)
{
	int i = 0;

	int cnt = 0;

	int k = -1;

	while (i!=4)
	{
	
		if (D - pow(2, k) >= 0)
		{
			decimal[i] = 1;

			D -= pow(2, k);

		}

		i++;

		k--;
	}

	
}

int Dfunction(double D)
{
	int cnt = 0;

	while (!judge(D))
	{

		if (cnt >= 4)
		{
			return 0;
		}

		D *= 2;

		cnt++;

	}

	return cnt;
}

int main(void)
{
	while (cin >> n, n>=0)
	{
		I = n;

		D = n - I;

		int cnt1 = 1;
		int cnt2 = 1;

		cnt1 = Ifunction(I,8);

		cnt2 = Dfunction(D);

		if (cnt1==0||cnt2==0)
		{
			cout << "NA" << endl;

			continue;
		}
		else
		{
			for (int i = 0; i < 8;i++)
			{
				cout << integer[i];
			}

			cout << ".";

			int flag = D*pow(2, cnt2);

			D2function(D);

			//DIfunction(flag,cnt2);

			for (int i = 0; i < 4; i++)
			{
				cout << decimal[i];
			}

			cout << endl;
		}

		fill(&integer[0], &integer[7], 0);
		fill(&decimal[0], &decimal[4], 0);

	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cassert>
#include <cmath>
#include <string>

using namespace std;

const double EPS=1e-9;

int main()
{
	for(char buf[1024];fgets(buf,1024,stdin),buf[0]!='-';){
		if(strlen(buf)>1000)
			assert(false);
		double x; sscanf(buf,"%lf",&x);
	//for(double x;scanf("%lf",&x),x>=0;){
		x/=256;
		
		if(x>=1){
			puts("NA");
			continue;
		}
		string s(12,'0');
		for(int i=0;i<12;i++){
			x*=2;
			if(x>=1){
				s[i]++;
				x-=1;
			}
		}
		if(x!=0){
			puts("NA");
			continue;
		}
		
		for(int i=0;i<8;i++)
			putchar(s[i]);
		putchar('.');
		for(int i=0;i<4;i++)
			putchar(s[8+i]);
		putchar('\n');
	}
	return 0;
}