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 <algorithm>
using namespace std;

int main(){
    double x;
    while(scanf("%lf",&x)){
        if(x<0) break;
        x *= 16;
        if(x > 1<<16)
            printf("NA");
        else if(x == (int)x){
            char str[20];
            str[8] = '.';
            str[13] = '\0';
            int n = x;
            for(int i=0; i<12; i++)
                str[(i<4)?(12-i):(11-i)] = (n & (1<<i))?'1':'0';
            printf("%s\n",str);
        }
        else
            printf("NA");
    }

    return 0;
}

C++: #include <stdio.h>

int main(void){
	double x;
	int n;
	char bin[14];
	
	bin[8] = '.';
	bin[13] = 0;
	while (scanf("%lf", &x), x>=0){
		// ??´??°??¨
		x -= (n = x);
		for (int i=0; i<8; i++){
			bin[7-i] = '0'+(n%2);
			n /=2;
		}
		if (n){
			puts("NA");
			continue;
		}
		// ?°???°??¨
		for (int i=0; i<4; i++){
			bin[9+i] = '0' + ((x*=2)>0);
			x -=n=x;
		}
		if (x>0){
			puts("NA");
			continue;
		}
		printf("%s\n",bin);
	}
	
	return 0;
}

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

using namespace std;

int main()
{
	string str1,str2;
	int i,j;
	double n;
	
	for(;;)
	{
		cin >> n;
		if(n<0.0)
			break;
		
		if(n>512.0)
			cout << "NA" << endl;
		
		int a=(int)n;
		n-=(double)a;
		
		for(i=0;i<8;i++)
		{
			if(a%2==0)
				str1[i]='0';
			else
				str1[i]='1';
			a/=2;
			
		}
		for(double a=2.0,j=0;j<4;a*=2,j++)
		{
			if(1.0/a<=n)
			{
				str2[j]='1';
				n-=1/a;
			}
			else
				str2[j]='0';
		}
		
		if(n==0.0)
		{
			for(i=7;i>=0;i--)
				cout << str1[i];
				cout << ".";
			for(i=3;i>=0;i--)
				cout << str2[i];
		}
		else
			cout << "NA";
		cout << endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cmath>

using namespace std;

int main(){
	
	string in;
	string ls,rs;
	string ans;
	long long li,ri;
	bool f;
	int sdata[8];
	int fdata[4]={5000,2500,1250,625};

	for(int i=0;i<8;i++){
		sdata[i]=pow(2,i);
	}

	while(1){
		cin>>in;
		if(in[0]=='-') break;

		ls="",rs="";
		f=false;
		for(int i=0;i<in.size();i++){
			if(in[i]=='.') f=true;
			else if(f){
				rs+=in[i];
			}
			else{
				ls+=in[i];
			}
		}

		li=0;
		for(int i=0;i<ls.size();i++){
			li+=(ls[ls.size()-1-i]-'0')*pow(10,i);
		}

		ri=0;
		for(int i=0;i<rs.size();i++){
			ri+=(rs[rs.size()-1-i]-'0')*pow(10,i);
		}
		for(int i=0;i<4-rs.size();i++){
			ri*=10;
		}
		ans="";
		for(int i=7;i>=0;i--){
			if(li>=sdata[i]){
				li-=sdata[i];
				ans+="1";
			}
			else ans+="0";
		}
		if(li!=0){
			cout<<"NA"<<endl;
			continue;
		}
		ans+=".";

		for(int i=0;i<4;i++){
			if(ri>=fdata[i]){
				ri-=fdata[i];
				ans+="1";
			}
			else ans+="0";
		}
		if(ri!=0){
			cout<<"NA"<<endl;
			continue;
		}
		cout<<ans<<endl;
	}

}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>

using namespace std;

int main(){

	char number[20],ans_upper[9],ans_under[5];
	int upper,under,index,S;

	while(true){
		scanf("%s",number);
		if(number[0] == '-')break;

		upper = 0;

		for(index = 0; number[index] != '.';index++){
			upper = 10*upper + (number[index] - '0');
		}

		if(upper >= 256){
			printf("NA\n");
			continue;
		}

		S = 128;

		for(int i = 0; i < 8; i++){
			if(upper >= S){
				ans_upper[i] = '1';
				upper -= S;
			}else{
				ans_upper[i] = '0';
			}
			S /= 2;
		}

		ans_upper[8] = '\0';


		under = 0;
		for(++index;number[index] != '\0'; index++){
			under = 10*under + (number[index] - '0');
		}

		if(under < 10){
			under *= 1000;
		}else if(under < 100){
			under *= 100;
		}else if(under < 1000){
			under *= 10;
		}

		for(int i = 0; i < 4; i++){
			under *= 2;
			if(under/10000 >= 1){
				ans_under[i] = '1';
			}else{
				ans_under[i] = '0';
			}
			under %= 10000;
		}

		if(under != 0){
			printf("NA\n");
			continue;
		}

		ans_under[5] = '\0';

		printf("%s.%s\n",ans_upper,ans_under);

	}

	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++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,j;
  double qq;
  scanf("%lf",&qq);
  n=(int)qq;
  j=(int)(10000*qq)-10000*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 if(j<10000){
      while(j<1000){
	j*=10;
      }
      int c=5000;
      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)(1000*qq)-1000*n;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    double x;
    while(cin >> x, x >= 0){
        int val = int(x*16);
        if(x == val/16.0 && val < 4096){
            cout << bitset<8>(val >> 4) << "." << bitset<4>(val&15) << "\n";
        }else puts("NA");
    }
    return 0;
}

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

int main(){
	while(1){
		double n;
		cin >> n;
		if(n < 0.0) break;
		if(n >= 256.0){
			cout << "NA\n";
			continue;
		}
		for(int i = 0;i < 4;i++) n *= 2;
		int a = (int)n;
		if(n - a > 0.0){
			cout << "NA\n";
			continue;
		}
		bool ans[12] = {0};
		for(int i = 0;i < 12;i++){
			ans[11 - i] = (a % 2);
			a /= 2;
		}
		for(int i = 0;i < 8;i++) cout << ans[i];
		cout << '.';
		for(int i = 0;i < 4;i++) cout << ans[8 + i];
		cout << endl;
	}
	return 0;
}