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<iostream>
#include<string>
using namespace std;
int main(){
	double x,t[]={128,64,32,16,8,4,2,1,0.5,0.25,0.125,0.0625};
	while(cin>>x,x>0){
		string s="";
		for(int i=0;i<12;i++){
			if(x-t[i]>=0){
				s+="1";
				x-=t[i];
			}
			else
			s+="0";
			if(i==7)
			s+=".";
		}
		if(x==0.0)
		cout<<s<<endl;
		else
		cout<<"NA"<<endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

string n;
int stoi(const string s) {
    int res;
    stringstream ss;
    ss << s;
    ss >> res;
    return res;
}
bool flag;
void split(string s,string& a, string& b) {
    int i=0;
    while(s[i]!='.'&&i<s.size()) {
        a+=s[i];
        i++;
    }
    i++;
    while(i<s.size()) b+=s[i],i++;

}
string decode1(string s) {
    string res="";
    int a = stoi(s);
    rep(i,8) {
        if(a&1) res+="1";
        else res+="0";
        a>>=1;
    }
    if(a!=0) flag=false;
    reverse(all(res));
    return res;
}

double func(string s) {
    double a;
    stringstream ss;
    ss<<s;
    ss>>a;
    return a;
}
string decode2(string s) {
    if(s=="") return "0000";
    string res="";
    int a = stoi(s);
    if(a==0) return "0000";
    double b = func("0."+s);

    rep(i,4) {
        b*=2;
        if(b>=1) res += "1",b-=1;
        else res+="0";
    }
    if(b != 0.0) flag=false;

    return res;
}
void solve() {
    flag=true;
    string a,b;
    split(n,a,b);
    string ans = decode1(a)+"."+decode2(b);
    if(flag) {
        cout<<ans<<endl;
    }
    else {
        cout<<"NA"<<endl;
    }

}
int main() {
    while(cin>>n) {
        if(func(n) < 0) break;
        solve();
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    double n;

    while (cin >> n, n != -1.0) {
        int up = (int)n;
        string u, l;
        
        n -= up;
        while (up != 0) {
            u += (up % 2) + '0';
            up /= 2;
        }
        if (u.size() > 8) {
            cout << "NA" << endl;
            continue;
        }
        while (u.size() < 8)
            u += '0';
        reverse(u.begin(), u.end());

        for (int i = 0; i < 5; i++) {
            n *= 2;
            if ((int)n == 1) {
                l += '1';

                if (n - (int)n == 0)
                    break;
            }
            else 
                l += '0';
        }

        if (l.size() > 4) {
            cout << "NA" << endl;
            continue;
        }
        while (l.size() < 4)
            l += '0';
        cout << u << '.' << l << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repb(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

signed main(){
	double a;
	while(1){
		cin >> a;
		if (a < 0) break;
		if(a>pow(2,8)){
			cout<<"NA"<<endl;
			continue;
		}
		string ans="";
		for(int i=7;i>=-4;i--){
			if(a/pow(2,i)>=1){
				ans+='1';
				a-=pow(2,i);
			}else ans+='0';
		}
		//o(ans);
		//o(a);
		if(a!=0.0){
			cout<<"NA"<<endl;
			continue;
		}
		rep(i,0,8) cout<<ans[i];
		cout<<".";
		rep(i,0,4) cout<<ans[8+i];
		cout<<endl;
	}
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

int main(){
	
	double d;
	
	while(true){
		cin >> d;
		if(d < 0){
			break;
		}
		
		double step = 0.0625;
		int ans = -1;
		
		for(double loop = 0; loop < 4096; loop += 1){
			if(d == step * loop){
				ans = loop;
			}
		}
		
		if(ans == -1){
			cout << "NA" << endl;
		}else{
			int dig[12];
			for(int i = 11; i >= 0; i--){
				dig[i] = ans % 2;
				ans /= 2;
			}
			for(int i = 0; i < 8; i++){
				cout << dig[i];
			}
			cout << ".";
			for(int i = 8; i < 12; i++){
				cout << dig[i];
			}
			cout << endl;
		}
		
	}
	
	return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 10000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;

static const double eps = 1e-8;

int main(){
	double n;	
	while(~scanf("%lf",&n)){
		if(n==-1.0) break;
		int a = n;
		double b = n - (double)a;

		bitset<8> front;
		for(int i=0;i<8;i++){
			if(a & (1<<i)) front |= (1<<i);
		}

		bitset<4> rear;
		for(int i=0;i<4;i++){
			if(b * 2.0 + eps > 1.0){
				rear |= (1<<i);
				b*=2.0;
				b -= 1.0;
			}
		}

		if(!(b+eps > 0.0 && b-eps < 0.0) || a != front.to_ulong()) {
			printf("NA\n");
		}
		
		
		else {
			string r = rear.to_string();
			reverse(r.begin(),r.end());
			printf("%s.%s\n",front.to_string().c_str(),r.c_str());
		}
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef vector<xy_t> polygon;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

int main(){
	int a;
	double b;
	double n;
	while(cin >> n && n > -EPS){
		string res;
		a = (int)n;
		b = n - (double)a;
		if(a >= (1 << 8)){
			cout << "NA" << endl;
			continue;
		}
		for(int i = 7; i >= 0; i--){
			if(a & (1 << i)) res.push_back('1');
			else res.push_back('0');
		}
		res.push_back('.');
		rep(i, 4){
			b *= 2;
			if(b > 1.0 - EPS){
				res.push_back('1');
				b -= 1.0;
			}else res.push_back('0');
		}
		if(abs(b) > EPS){
			cout << "NA" << endl;
			continue;
		}
		cout << res << endl;
	}
	return 0;
}