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>

using namespace std;


void changeBinary( int target ){
	int i;
	char str[20] = {'0'};

	i = 0;
	while( target != 0 ){
		str[i] = target % 2 + '0';
		target /= 2;
		i++;
	}
	if( i == 0 ) cout << "00000000.0000";
	else{
		for( int j = 0;j < 12 - i;j++ ) cout << '0';
		for( int j = 0;j < i;j++ ){
			if( i - j == 4 ) cout << '.';
			cout << str[( i - 1) - j ];
		}
	}
	cout << endl;


}
int main(void)
{
	double n;
	int target;

	while( cin >> n && n >= 0 ){
		n *= 16;

		if( n - (int)n || n > ( 1 << 11 ) ){
			cout << "NA" << endl;
		} else {
			target = n;
			changeBinary( target );
		}

	}

	return 0;
}

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

using namespace std;

int A[8];
int B[4];

int main(int argc, char** argv)
{
	int a, c;
	double b;
	double d;
	
	while( 1 )
	{
		cin >> d;
		if(d < 0.0) break;
		
		a = (int)d;
		b = d - a;
		
		for(int i=7; i>=0; i--)
		{
			A[i] = a%2;
			a /= 2;
		}
		
		for(int i=0; i<4; i++)
		{
			b *= 2.0;
			if(b>=1.0) B[i] = 1, b-=1.0;
			else B[i] = 0;
		}
		
		if(a==0 && b==0.0)
		{
			for(int i=0; i<8; i++) cout << A[i];
			cout << ".";
			for(int i=0; i<4; i++) cout << B[i];
			cout << endl;
		}
		else cout << "NA" << endl;
	}
	
	return 0;
}

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

double eps = 1.0e-8;
bool eq(double a, double b){
  return abs(a-b) < eps;
}
int main()
{
  
  while(true){
    double p;
    bool b[4] = {false,};
    cin >> p;
    if( p < 0 ) break;
    int d = (int)floor(p+eps);
    
    p = p - d;
    double c = 0.5;
    bool na=false;
    int n = 0;

    bitset<8> bi(d);
    //cout << d << endl;

    while( true ){
      if( p >= c ){
	p -= c;
	b[n] = true;
	if( eq(p,0) ) break;
      }
      ++n;
      c *= 0.5;
      if( n == 5 ){
	na = true;
	break;
      }
    }
    
    if( d > 255 ) na = true;

    if( na ){
      cout <<"NA"<<endl;
    }else{
      for(int i = 0; i < 8; ++i){
	cout << bi[7-i];
      }
      cout << '.';
      for(int i = 0; i < 4; ++i){
	if( b[i] ){
	  cout << '1';
	}else{
	  cout << '0';
	}
      }
      cout << endl;
    }
    
  }
  return 0;
}

C++: #include<iostream>
 
using namespace std;
 
int main()
{
    for(double a;cin>>a,a>=0;){
        int n=(int)(a*16);
        if(n>(1<<12) || n!=a*16)   cout<<"NA"<<endl;
        else{
            for(int i=11;i>=0;i--){
                if(i==3)    cout<<'.';
                cout<<(bool)(n&(1<<i));
            }
            cout<<endl;
        }
    }
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
    double num;

    while(cin >> num, num >= 0){
        long long tmp = (long long)num;

        string ans = "";
        stack<char> st;
        for(int i = 0;i < 8;i++){
            st.push((tmp % 2) + '0');
            tmp /= 2;
        }

        if(tmp != 0){
            cout << "NA" << endl;
            continue;
        }

        while(!st.empty()){
            ans.push_back(st.top());
            st.pop();
        }

        double t2 = num - (long long)num;

        ans.push_back('.');

        for(int i = 0;i < 4;i++){
            t2 *= 2;
            if(t2 >= 1){
                ans.push_back('1');
                t2 -= 1;
            }else{
                ans.push_back('0');
            }
        }

        if(t2 > 0){
            cout << "NA" << endl;
            continue;
        }

        cout << ans << endl;

    }

    return 0;
}

C++: #include<stdio.h>

int main(){
int b1[9]={},b2[9]={};

int x1,x2;

//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){
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");
for(int i=0;i<9;i++)
{
b1[i]=0;b2[i]=0;
}


}

else printf("NA\n");
}
}
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 << 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;
    }
    }
}