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 <cstdio>
#include <cctype>
#include <utility>
#include <string>
#include <cmath>
#include <vector>
using namespace std;

#define _gp(l) const auto gcu{getchar##l}; const auto pcu{putchar##l}
#ifdef __linux
_gp(_unlocked);
#else
_gp();
#endif
#define _DEF(r, n, ...) inline r n(__VA_ARGS__) noexcept
#define _T template<typename T>
#define _HT template<typename H,typename... T>
_T _DEF(T,in,int c){T n{};int m{1};while(isspace(c)){c=gcu();}if(c=='-')m=-1,c=gcu();do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m*n;}
_DEF(int,in,){return in<int>(gcu());}
#define _SCAN(...) _DEF(bool,scan,__VA_ARGS__)
_SCAN(char &c){c=gcu();gcu();return c!=EOF;}
_T _SCAN(T &n){int c{gcu()};return c==EOF?false:(n=in<T>(c),true);}
#define _OUT(...) _DEF(void,out,__VA_ARGS__)
#define _OUTL(...) _DEF(void,outl,__VA_ARGS__)
_OUT(bool b){pcu('0'+b);}
_OUT(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_SCAN(string &s){int c;s="";for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=(char)c;}}
_OUT(string s){for(char c:s)pcu(c);}
#endif
_OUT(const char *s){while(*s)pcu(*s++);}
_T _OUT(T n){static char b[20];char *p{b};T m=n<0?pcu('-'),-1:1;if(!n)*p++='0';else while(n)*p++=(char)(n%10*m+'0'),n/=10;while(p!=b)pcu(*--p);}
_OUTL(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _OUT(vector<T> v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);}
#endif
_HT _SCAN(H &h,T&&... t){return scan(h)&&scan(t...);}
_HT _OUT(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _OUTL(T&&... t){out(move(t)...);outl();}
struct range{int e,b{0},s{1};range(int _b,int _e,int _s):e(_e),b(_b),s(_s){}range(int _b,int _e):e(_e),b(_b){}range(int _e):e(_e){}
	struct it{int v,s;it(int _v,int _s):v(_v),s(_s){}operator int()const{return v;}operator int&(){return v;}int operator*()const{return v;}it& operator++(){v+=s;return *this;}};
	it begin(){return{b, s};}it end(){return{e,s};}};

int main() {
	for (double n; scanf("%lf", &n), n >= 0;) {
		vector<int> a;
		double b = 1.0 / (1 << 7);
		for (int i {}; i < 12; i++, b *= 2) {
			int r = fmod(n * b, 2.0);
			n -= r / b;
			a.push_back(r);
		}
		if (n)
			outl("NA");
		else {
			for (int i: range(12)) {
				if (i == 8)
					out('.');
				out(a[i]);
			}
			outl();
		}
	}
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i;
  int n;
  string s,t,u;
  while(cin>>s&&s[0]!='-'){
    n=atoi(s.substr(0,s.find(".")).c_str());
    if(n>255){
      cout<<"NA"<<endl;
      continue;
    }
    t=u="0000";
    for(i=1;i<(int)(s.length()-s.find("."));i++)
      t[i-1]=s[s.find(".")+i];
    if(t[0]>'4'){
      t[0]-=5;
      u[0]++;
    }
    if(t[0]>'1'&&t[1]>'4'){
      t[0]-=2;
      t[1]-=5;
      u[1]++;
    }else if(t[0]>'2'){
      t[0]-=3;
      t[1]+=5;
      u[1]++;
    }
    if(t[0]>'0'&&t[1]>'1'&&t[2]>'4'){
      t[0]-=1;
      t[1]-=2;
      t[2]-=5;
      u[2]++;
    }
    if(t[1]>'5'&&t[2]>'1'&&t[3]>'4'){
      t[1]-=6;
      t[2]-=2;
      t[3]-=5;
      u[3]++;
    }
    if(t!="0000"){
      cout<<"NA"<<endl;
      continue;
    }
    for(i=0;i<8;i++){
      cout<<n/(int)pow(2,7-i);
      n%=(int)pow(2,7-i);
    }
    cout<<"."<<u<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
const double eps = 1e-9;

double pw2[12] = {128, 64, 32, 16, 8, 4, 2, 1, 0.5, 0.25, 0.125, 0.0625};

string to_bit(double n) {
    string s = "";
    for (int i=0; i<12; ++i) {
        double d = pw2[i];
        if (d < n + eps) {
            n -= d;
            s += "1";
        } else {
            s += "0";
        }
        if (d == 1) s += ".";
    }
    return s;
}

int main() {
    double n;
    while (cin >> n, 0 <= n) {
        if (abs(n*16 - round(n*16)) < eps && n < 256 + eps) {
            cout << to_bit(n) << endl;
        } else {
            cout << "NA" << endl;
        }
    }
    return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
int main()
{
    double n,m;
    int a = 0;
    int res = 0;
    int bai = 1;
    double ans = 0,ahokusa = 0;
    while(cin >> n)
    {
        if(n == -1.0)return 0;
        while(1)
        {
            a = n;
            m = n - a;
            if(a > 256 || m < 0.0625)
            {
                puts("NA");
            }
            else
            {
                while(a > 0)
                {
                    res += (a%2)*bai;
                    a /= 2;
                    bai *= 10;
                }
            }
            ans += res;
            int asukoge = 0;
            for(int i = 1; i < 5; i++)
            {
                if(m == 1/pow(2,i))ahokusa += pow(0.1,i);
                if(i == 16 && ahokusa == 0)
                {
                    puts("NA");
                    break;
                }
            }
            printf("%13.4f\n",ans+ahokusa);
            break;
        }
    }

    return 0;
}

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

vector<int>bit;

void convert(int);

int main(){
  while(1){
    double n, num2;
    int num;
    cin >> n;
    if(n<0) break;
    bit.clear();
    num=(int)n;
    num2=n-num;
    convert(num);

    string out;
    
    if(num2==0.5){
      out ="1000";
    }
    else if(num2==0){
      out="0000";
    }
    else if(num2==0.25){
      out="0100";
    }
    else if(num2==0.125){
      out = "0010";
    }
    else if(num2==0.0625){
      out = "0001";
    }
    else if(num2==0.1875){
      out = "0011";
    }
    else if(num2==0.3125){
      out = "0101";
    }
    else if(num2==0.375){
      out = "0110";
    }
    else if(num2==0.4375){
      out = "0111";
    }
    else if(num2==0.5625){
      out = "1001";
    }
    else if(num2==0.625){
      out = "1010";
    }
    else if(num2==0.6875){
      out = "1011";
    }
    else if(num2==0.75){
      out = "1100";
    }
    else if(num2==0.8125){
      out = "1101";
    }
    else if(num2==0.875){
      out = "1110";
    }
    else if(num2==0.9375){
      out = "1111";
    }
    else{
      cout << "NA" << endl;
      continue;
    }

    int l=bit.size();
    if(l>8){
      cout << "NA" << endl;
      continue;
    }
    for(int i=0;i<8-l;i++){
      cout << '0';
    }
    for(int i=0;i<l;i++){
      if(bit[i]==-1) break;
      cout << bit[i];
    }
    cout << '.';
    cout << out;
    cout << endl;
  }
  return 0;
}

void convert(int x){
  if(x==0) return;
  convert(x/2);
  bit.push_back(x%2);
}