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")
		}
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include <algorithm>
#include<functional>
#include<cstdlib>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define CI cin >>
#define CO cout <<
#define E << endl;

using namespace std;

typedef pair<int, int> P;
typedef pair<long, long> LP;
typedef pair<int, P> PP;
typedef pair<long, LP> LPP;



int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

int A = 0, B = 0, K = 0, T = 0, W = 0, N = 0, H = 0;
int n = 0;
double L = 0;
double S = 0;
double ar = 0, br = 0, cr = 0;
int answer = 0;

string C;
string sA, strB;
vector<vector<char>> map;
vector<double> num;
vector<string> str;

int sum = 0;


double tempd = 0.0;



void input() {
	while (true) {
		CI tempd;
		if (tempd < 0.0) {
			break;
		}
		num.push_back(tempd);
	}

	return;
}


int main(void) {
	double deci;
	int numd;
	vector<int> int_array;
	vector<int> deci_array;
	input();

	for (int i = 0; i < num.size(); i++) {
		numd = num[i];
		deci = num[i] - (double)numd;
		
		while (true) {
			if (numd == 0) {
				break;
			}
			int_array.push_back(numd % 2);
			numd /= 2;
		}
		if (int_array.size() > 8) {
			CO "NA" E
			int_array.clear();
			int_array.shrink_to_fit();
			deci_array.clear();
			deci_array.shrink_to_fit();
			continue;
		}
		 
		bool flag = false;
		int nx = 0;
		while (true) {
			if (deci == (double)(int)deci) {
				break;
			}
			nx++;
			deci *= 2;
			deci_array.push_back((int)deci % 10);
		
		
			if (deci_array.size() > 4) {
				CO "NA" E
				int_array.clear();
				int_array.shrink_to_fit();
				deci_array.clear();
				deci_array.shrink_to_fit();
				flag = true;
				break;
			}
		}
		if (flag) {
			flag = false;
			continue;
		}
		

		for (int j = 0; j < 8 - int_array.size(); j++) {
			CO 0;
		}
		for (int j = int_array.size() - 1; j >= 0; j--) {
			CO int_array[j];
		}
		CO ".";
		for (int j = 0; j < deci_array.size(); j++) {
			CO deci_array[j];
		}
		for (int j = 0; j < 4 - nx; j++) {
			CO 0;
		}
		CO "\n";
		int_array.clear();
		int_array.shrink_to_fit();
		deci_array.clear();
		deci_array.shrink_to_fit();
	}


	return 0;
}

C++: // Tazoe

#include <iostream>
using namespace std;

void conv(int n, int p)
{
	if(p==0)
		return;

	conv(n/2, p-1);

	if(p==9){
		cout << '.';
	}
	cout << n%2;
}

int main()
{
	while(true){
		double n;
		cin >> n;

		if(n<0.0)
			break;

		int n16 = (int)(n*16.0);
		if(n*16.0!=(double)n16||n16>=4096){
			cout << "NA" << '\n';
			continue;
		}

		conv(n16, 12);
		cout << '\n';
	}

	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  double in;
  while(cin >> in){
    if(in == -1) break;

    double dec;
    dec = in - (int)in;
    in = (int)in;

    int data[12];
    int div = 128;
    for(int i = 0; i < 8; i++){
      if(in >= div){
	data[i] = 1;
	in -= div;
      }else data[i] = 0;
      div /= 2;
    }
    double divd = 0.5;
    for(int i = 8; i < 12; i++){
      if(dec >= divd){
	data[i] = 1;
	dec -= divd;
      }else data[i] = 0;
      divd /= 2;
    }

     if(in || dec){
      cout << "NA" << endl;
      continue;
      }

    for(int i = 0; i < 8; i++) cout << data[i];
    cout << ".";
    for(int i = 8; i < 12; i++) cout << data[i];
    cout << endl;
  }
  return 0;
}

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

using namespace std;

#define MAX 10

double d;

int main() {
	while (1) {
		scanf("%lf", &d);
		if (d < 0)
			return 0;

		if(d >= 256 || fmod(d, .0625) != 0)
			puts("NA");
		else {
			double r = 128;
			for(int i = 0; i < 12; i++, r *= .5) {
				if(i == 8)
					printf(".");
				printf("%d", d / r >= 1);
				d = fmod(d, r);
			}
			puts("");
		}
	}
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	double kaga,laura;
	int d[13];
	while(cin>>kaga){
		if(kaga<0)break;
		laura=128;
		for(int i=1;i<=12;i++,laura*=0.5){
			d[i]=0;
			if(kaga>=laura){
				d[i]=1;
				kaga-=laura;
			}
		}
		if(kaga==0){
			for(int i=1;i<=12;i++){
				cout<<d[i];
				if(i==8)cout<<".";
			}
			cout<<endl;
		}
		else cout<<"NA"<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int to_i(string s){
	int res=0;
	for(int i=0;i<s.size();i++){
		res*=10;
		res+=s[i]-'0';
	}
	return res;
}
string to_b(int n,int d){
	string s;
	for(int i=0;i<d;i++){
		s+=((n>>d-i-1)&1)+'0';
	}
	return s;
}

int main(){
	string s;
	while(cin>>s&&s[0]!='-'){
		bool ok=true;
		int p=s.find('.',0);
		if(p==string::npos){
			p=s.size()+1;
			s+=".0000";
		}
		else p++;
		if(p+4>s.size()){
			s.append(p+4-s.size(),'0');
		}
		int n=to_i(s.substr(0,p-1));
		if((n&((1<<8)-1)) !=n )ok=false;
		int b=0;
		if(ok){
			int m=to_i(s.substr(p,s.size() ));
			int a=5000;
			for(int i=0;i<4;i++){
				if(a<=m){
					m-=a;
					b|=1<<3-i;
				}
				a/=2;
			}
			if(m)ok=false;
		}
		if(ok)cout<<to_b(n,8)<<'.'<<to_b(b,4)<<endl;
		else cout<<"NA\n";
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
int b1[9]={},b2[9]={};

int x1=0,x2=0;

//double x1,x2=0;
//int y1=0,y2=0;
/*
while(scanf("%lf",&x)!=EOF){
x2=x1*10000;
y2=(int)x1;y2*=10000;
y2=(int)x2-(int)x1*10000;
y1=(int)x1;
if(y1>255||y2>9375||b2)

*/

//while(scanf("%d.%d",&x1,&x2)!=EOF){
double p;
while(1){
	scanf("%lf",&p);
	
	if(p<0)break;
	x1=(int)p;p=p*10000;x2=(int)p-10000*x1;
//x2*=1000;
//if(x1>255||x2>9375||x2<625)printf("NA\n");

//else 
{
if(x1>=128){x1=x1-128;b1[0]=1;}
if(x1>=64){x1=x1-64;b1[1]=1;}
if(x1>=32){x1=x1-32;b1[2]=1;}
if(x1>=16){x1=x1-16;b1[3]=1;}
if(x1>=8){x1=x1-8;b1[4]=1;}
if(x1>=4){x1=x1-4;b1[5]=1;}
if(x1>=2){x1=x1-2;b1[6]=1;}
if(x1>=1){x1=x1-1;b1[7]=1;}

if(x2>=5000){x2=x2-5000;b2[0]=1;}
if(x2>=2500){x2=x2-2500;b2[1]=1;}
if(x2>=1250){x2=x2-1250;b2[2]=1;}
if(x2>=625){x2=x2-625;b2[3]=1;}

if(x1==0&&x2==0)
{
for(int i=0;i<8;i++)
printf("%d",b1[i]);

printf(".");

for(int i=0;i<4;i++)
printf("%d",b2[i]);

printf("\n");

}

else printf("NA\n");


for(int i=0;i<9;i++)
{
b1[i]=0;b2[i]=0;
}


}
}
return 0;
}

C++: //35
#include<iostream>

using namespace std;

int main(){
  for(double d;cin>>d,d>0;d++){
    int i=d*16;
    if(i>=1<<12||d*16-i){
      cout<<"NA"<<endl;
    }else{
      for(int j=0;j<12;j++){
	if(j==8){
	  cout<<'.';
	}
	cout<<!!(i&1<<(11-j));
      }
      cout<<endl;
    }
  }
  return 0;
}