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<bits/stdc++.h>
using namespace std;
int main(){
  int n,j;
  double qq;
  scanf("%lf",&qq);
  n=(int)qq;
  j=(int)(100000*qq)-100000*n;
  // cout<<n<<' '<<j<<endl;
  while(n>=0){
    int nn=n;
    int ji[8]={},kyo[4]={},a=0;
    for(int i=0;i<8;i++){
      if(nn%2!=0){
	ji[i]=1;
      }else{
	ji[i]=0;
      }
      nn=nn/2;
      // cout<<nn<<endl;
    }
    if(nn){
      a=1;
    }else{
      int c=50000;
      for(int i=0;i<4;i++){
	//cout<<j<<endl;
	if((j-c)>=0){
	  kyo[i]=1;
	  j-=c;
	}else{
	  kyo[i]=0;
	}
	c/=2;
	//cout<<c<<endl;
      }
    }
    if(j){
      a=1;
    }
    if(a==0){
      for(int i=7;i>=0;i--){
	cout<<ji[i];
      }
      cout<<'.';
      for(int i=0;i<4;i++){
	cout<<kyo[i];
      }
      cout<<endl;
    }else{
      cout<<"NA"<<endl;
    }
    scanf("%lf",&qq);
    n=(int)qq;
    j=(int)(100000*qq)-100000*n;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int main() {
	double n;
	while (cin >> n, n >= 0) {
		n *= 16;
		ll a = n;
		
		if (a < n) { puts("NA"); continue; }
		
		int ans[12] = {};
		REP(i, 12) {
			ans[11 - i] = a % 2;
			a /= 2;
		}
		
		if (a > 0) puts("NA");
		else {
			REP(i, 8) putchar('0' + ans[i]);
			putchar('.');
			FOR(i, 8, 12) putchar('0' + ans[i]);
			puts("");
		}
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int nisin[12],su[8]={128,64,32,16,8,4,2,1};
	double n,y;	int i;
	while(1){
		scanf("%lf",&n);
		if(n<0) break;
		else{
			for(i=0;i<12;i++) nisin[i]=0;
			if(n<256){
				for(i=0;i<8;i++){
					if(n>=su[i]){
						n-=su[i]; nisin[i]=1;
					}
				}
				if(n>0){
					y=0.5;
					for(i=8;i<12;i++){
//printf("y=%.4lf\n",y);
						if(n>=y){
							n-=y; nisin[i]=1;
						}
						y=y/2;
					}
				}
				if(n==0.0){
					for(i=0;i<12;i++){
						if(i==8) printf(".");
						printf("%d",nisin[i]);
					}
					printf("\n");
				}
				else printf("NA\n");
			}
			else printf("NA\n");
		}
		
	}
	return 0;
}

C++: #include<iostream>
#include<map>
#include<sstream>
#include<algorithm>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

string compute(int n,bool &flag){
  string ret ="";
  while(n>0){
    if (n%2 == 1)ret+="1";
    else ret+="0";
    n/=2;
  }
  if (ret.size() > 8){
    flag=false;
    return "";
  }
  flag=true;
  while(ret.size() != 8)ret+="0";
  reverse(ret.begin(),ret.end());
  return ret;
}

void makeall(map<string,string> &M){
  const int aho[4]={5000,2500,1250,625};
  rep(i,(1<<4)){
    int val=0;
    rep(j,4){
      if ( (i&(1<<j)) != 0)val+=aho[j];
    }
    stringstream sin;
    sin<<val;
    string key;
    sin>>key;
    while(key.size() != 4)key="0"+key;
    string ret="";
    rep(j,4){
      if ( (i&(1<<j)) != 0)ret+="1";
      else ret+="0";
    }
    //    cout << key <<" " << ret << endl;
    M[key]=ret;
 }
}
/*
string compute2(int m,bool &flag){
  const int aho[4]={5000,2500,1250,625};
  rep(i,(1<<4)){
    //cout << i << endl;
    int val=0;
    rep(j,4){
      if ( (i&(1<<j)) != 0)val+=aho[j];
    }
    cout << val << endl;
    if (val == m){
      string ret="";
      rep(j,4){
	if ( (i&(1<<j)) != 0)ret+="1";
	else ret+="0";
      }
      flag=true;
      return ret;
    }
  }
  flag=false;
  return "";
}
*/

main(){
  int n,m;
  char dummy;
  string in;
  map<string,string> M;
  makeall(M);
  while(getline(cin,in) && in[0] != '-'){
    bool isper=false;
    int m=0;
    int cnt=0;
    string ahoge="";
    rep(i,in.size()){
      if (in[i] == '.'){
	isper=true;
	in[i]=' ';
      }else if (isper){
	ahoge+=in[i];
      }
    }
    while(ahoge.size() != 4)ahoge+="0";
    
    stringstream sin(in);
    sin>>n;
    


    
    bool flag;
    string a=compute(n,flag);
    if (!flag){
      cout << "NA" << endl;
      continue;
    }
    //    cout << ahoge << endl;
    if (M.find(ahoge) != M.end())cout << a << "." << M[ahoge] << endl;
    else cout << "NA" << endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
	float a;
	int s,d[13],f,g,h=0,i,j,z;
	while(1){
		scanf("%f",&a);
		z=a;
		if(z<0){
			break;
		}
		for(i=1;i<=12;i++){
			d[i]=0;
		}
		//printf("%f",a);
		f=a*16;
		i=4096;
		//printf("a == %f\n",a*16);
		s=f;
		j=1;
		while(i!=1){
			i=i/2;
			if(i<=f){
				d[j]=f/i;
				//printf("d[%d] = %d %d %d\n",j,d[j],i,f);
				f=f-i;
			}
			j++;
		}
		if(a>=4096){
			printf("NA\n");
			h=1;
			//printf("1111\n");
		}
		if((a*16)-s>0){
			//printf("2222 = %d\n",a*16-s);
			printf("NA\n");
			h=1;
		}
		/*for(i=0;i<12;i++){
			printf("%d\n",d[i]);
		}*/
		if(h==0){
			for(i=1;i<=12;i++){
				printf("%d",d[i]);
				if(i==8){
					printf(".");
				}
			}
			printf("\n");
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void)
{
	double a;
	int i;
	int box[12]={0,0,0,0,0,0,0,0,0,0,0,0};
	double nisin[12]={128.0,64.0,32.0,16.0,8.0,4.0,2.0,1.0,0.5,0.25,0.125,0.0625};

	cin >> a;
	while(a>0.0){
		for(i=0;i!=12;i++){
			if(a>=nisin[i]){
				a=a-nisin[i];
				box[i]=1;
			}
		}
		if(a==0.0){
			for(i=0;i!=12;i++){
				cout << box[i];
				if(i==7){
					cout << '.';
				}
			}
		}
		else{ 
			cout << "NA";
		}
		cout << endl;
		cin >> a;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
using namespace std;
 
int d[8] = {128, 64, 32, 16, 8, 4, 2, 1};
float f[4] = {0.5, 0.25, 0.125, 0.0625};
int main(){
    double in;
    while(cin>>in,in>0){
        vector<int> ans(12,0);
        bool used = false;
         
        for(int i=0; i < 8; i++){
            if(d[i] <= in){
                ans[i] = 1;
                in -= d[i];
                used = true;
            }
        }
        for(int i=0; i < 4; i++){
            if(f[i] <= in){
                ans[i+8] = 1;
                in -= f[i];
                used = true;
            }
        }
        if(used && in == 0){
            for(int i=0; i < 8; i++){
                cout << ans[i];
            }
            cout << '.';
            for(int i=8; i < 12; i++){
                cout << ans[i];
            }
            cout << endl;
        }
        else cout << "NA" << endl;
    }
}

C++: //メモリ数確認したか?
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
typedef long long int ll;
#define EPS 1e-4;
int main()
{
	while(true){
        double a;
		cin >> a;
		if(a<0)return 0;
		double x=128.0;
		string ans="";
		while(x>0.05){
			if(a>=x){
				a-=x;
				ans+='1';
			}
			else ans+='0';
			x/=2;
			if(x==0.5)ans+=".";
		}
		if(a==0){
		cout << ans << "\n";
		}
		else cout << "NA" << "\n";
	}
    return 0;
}
//メモリ数確認したか?