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()
{
    double N;
    while(cin >> N, N >= 0)
    {
        int n = N * 16 + 1e-8;
        if (abs(N * 16 - (int)(N * 16)) < 1e-8 || n >= (1 << 12))
        {
            puts("NA");
            break;
        }
        for (int i = 11; i >= 0; i--)
        {
            printf("%d", (n >> i) & 1);
            if (i == 4) printf(".");
        }
        puts("");
    }
    return 0;
}

C++: #include <cstdio>
#include <iostream>
#include <iomanip>
#include <string> 
#include <vector> 
using namespace std;
  
int main(){
    /*??£???????????????????????????
            int a[2];
            cin >> a[1] >> a[2];
            cout << "[+] " << a[1] + a[2] << endl;
            cout << "[-] " << a[1] - a[2] << endl;
            cout << "[*] " << a[1] * a[2] << endl;
            cout << "[/] " << a[1] / a[2] << endl;
    */

    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]++;
            //cout << ans[0] << " " << co[0] <<  endl; 
            if(co[0] >= 8){check = 1;break;}
        }
        //cout << co[0] << endl;
        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;}
            }else{
                ans[1] = ans[1] + "0";
                co[1]++;
                if(co[1] >= 4){check = 1;break;}
            }
            
        }
        //cout << ans[1] << endl;
        //cout << co[1] << endl;
        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<bits/stdc++.h>

using namespace std;

int main()
{
    double N;
    cin >> N;
    int n = N * 16 + 1e-8;
    for (int i = 11; i >= 0; i--)
    {
        printf("%d", (n >> i) & 1);
        if (i == 4) printf(".");
    }
    puts("");
    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;
}

string decode2(string s) {
    if(s=="") return "0000";
    string res="";
    int a = stoi(s);
    if(a==0) return "0000";
    while(a<1000) a*=10;
    // cout<<a<<endl;
    double b = a / 10000.0;

    rep(i,4) {
        b*=2;
        // cout<<b<<endl;
        if(b>0) 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(n=="-1.0") break;
        solve();
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#include<map>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
const double PI=acos(-1);
using namespace std;
double han[12]={128,64,32,16,8,4,2,1,0.5,0.25,0.125,0.0625};
int main(){
  double n;
  while(cin>>n,n>=0){
    vector<int>out(12);
    rep(i,12){
      out[i]=n/han[i];
      if(out[i])n-=han[i];
    }
    if(!n){
      rep(i,8)cout<<out[i];
      cout<<".";
      rep(i,4)cout<<out[i+8];
      cout<<endl;
    }else cout<<"NA"<<endl;
  }
}

C++: 
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

int main()
{
	double num,flt;
	string ans="";
	while (cin >> num, num > 0) {
		int F[5] = {0}, I[10] = { 0 };
		int i = 0, j = 7;
		int n = (int)num;
		flt = num - n;

		if (n > 255) ans = "NA";
		else {
			rep(i, 4) {
				flt *= 2;
				F[i++] = (int)(flt * 10) / 10;
				if (flt == 1.0)break;
				else if (flt > 1.0)
					flt = (int)(flt * 10) % 10;
			}
			if (flt != 0 && flt != 1.0)ans = "NA";

			if (ans == "NA")cout << ans << endl;
			else {
				while (1) {
					I[j--] = n % 2;
					n /= 2;
					if (n == 0)break;
				}
				rep(i, 8)cout << I[i];
				cout << ".";
				rep(i, 4)cout << F[i];
				cout << endl;
			}
		}
	}
	return	0;
}