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 <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("%013.4f\n",ans+ahokusa);
            break;
        }
    }

    return 0;
}

C++: #include <cstdio>
#include <cmath>

using namespace std;

const double EPS=1e-9;

int main()
{
	for(char buf[1024];fgets(buf,1024,stdin),buf[0]!='-';){
		double x; sscanf(buf,"%lf",&x);
		
		if(x>=256){
			puts("NA");
			continue;
		}
		if(fmod(x,0.0625)>EPS){
			puts("NA");
			continue;
		}
		
		int a=x+EPS,b=int(x*16+EPS)%16;
		for(int i=0;i<8;i++)
			putchar('0'+(a>>7-i&1));
		putchar('.');
		for(int i=0;i<4;i++)
			putchar('0'+(b>>3-i&1));
		putchar('\n');
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

string itos(int n){
	string res="";
	while(n/2){
		res=(char)(n%2+'0')+res;
		n/=2;
		if(n==1){
			res='1'+res;
		}
	}
	return res;
}

string dotos(int x){
	string res="";
	if(x>=5000){
		res+='1';
		x-=5000;
	}else{
		res+='0';
	}
	if(x>=2500){
		res+='1';
		x-=2500;
	}else{
		res+='0';
	}
	if(x>=1250){
		res+='1';
		x-=1250;
	}else{
		res+='0';
	}
	if(x>=625){
		res+='1';
		x-=625;
	}else{
		res+='0';
	}
	if(x>0)res="NA";
	return res;
}

void print(double x){
	string res="";
	int re=(int)x;
	int dd=(int)((x-re)*10000);
	res=itos(re)+"."+dotos(dd);
	int size=itos(re).size();
	if(size<8){
		rep(i,8-size){
			res='0'+res;
		}
	}else if(size>8){
		res="NA";
	}
	if(dotos(dd)=="NA"){
		res="NA";
	}
	cout<<res<<endl;
	return;
}

int main(){
	double num;
	while(cin>>num,num>=0){
		print(num);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(void){
  double in;
  while(cin>>in,in!=-1){
    if(in>128){cout<<"NA"<<endl;continue;}
    cout<<(64<=in&&in<128?1:0);
    if(64<=in)in-=64;
    cout<<(32<=in&&in<64?1:0);
    if(32<=in)in-=32;
    cout<<(16<=in&&in<32?1:0);
    if(16<=in)in-=16;
    cout<<(8<=in&&in<16?1:0);
    if(8<=in)in-=8;
    cout<<(4<=in&&in<8?1:0);
    if(4<=in)in-=4;
    cout<<(2<=in&&in<4?1:0);
    if(2<=in)in-=2;
    cout<<(1<=in&&in<2?1:0);
    if(1<=in)in-=1;
    cout<<".";
    cout<<(0.5<=in&&in<0?1:0);
    if(0.5<=in)in-=0.5;
    cout<<(0.25<=in&&in<0.5?1:0);
    if(0.25<=in)in-=0.25;
    cout<<(0.125<=in&&in<0.25?1:0);
    if(0.125<in)in-=0.125;
    cout<<(0.0625<=in&&in<0.125?1:0);
    if(0.0625<in)in-=0.0625;
    cout<<endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <string>
#include <set>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#define rep(i, a, n) for(int (i) = (int)(a);(i) < (int)(n);++(i))
#define repe(i, a, n) for(int (i) = (int)(a);(i) <= (int)(n);++(i))
#define repr(i, a, n) for(int (i) = (int)(a);(i) > (int)(n);--(i))
#define reper(i, a, n) for(int (i) = (int)(a);(i) >= (int)(n);--(i))
#define SIZE(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define RNG(x, n) &((x)[0]), &((x)[n])
#define SUBIF(a, b, x) ((x) ? (b) : (a))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define pb push_back
#define EPS (1e-20)
#define INF 2147483647
#define MOD 1000000007
using llint = long long;
using VI = std::vector<int>;
using PII = std::pair<int, int>;
using SI = std::set<int>;
using MII = std::map<int, int>;
using TIII = std::tuple<int, int, int>;
using namespace std;


double n;


bool judge(double x){
	return (x == (int)x);
}


string solve(){
	n *= 16;
	if(!judge(n)) return "NA";
	int N = (int)n;
	string bin;
	do {
		bin.pb('0'+(N&1));
	} while(N/=2);
	string integer, decimal;
	reper(i, 3, 0) decimal.pb(bin[i]);
	rep(i, 0, 12-SIZE(bin)) integer.pb('0');
	reper(i, SIZE(bin)-1, 4) integer.pb(bin[i]);
	return integer+'.'+decimal;
}


signed main(){
	while(cin >> n, 0 <= n) cout << solve() << endl;

	return 0;
}

C++: #include<iostream>
using namespace std;
double a;
string s;
main()
{
	while(cin>>a,a>=0)
	{
		s="";
		for(double i=128;i>0.06;i/=2)
		{
			if(a>=i)
			{
				s+="1";
				a-=i;
			}
			else s+="0";
			if(i==1)s+=".";
		}
		if(a)s="NA";
		cout<<s<<endl;
	}
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  float n;
  while(cin>>n,n>0){
    string s = "";
    for(int i = 0 ; i < 8 ; i ++){
      if(n >= (1<<(7-i))){
	n -= (1<<(7-i));
	s += '1';
      }else
	s += "0";
    }
    s += '.';
    
    for(int i = 0 ; i < 4 ; i ++){
      double miya = 1.0/(1<<(i+1));
      if(n >= miya){
	n -= miya;
	s += '1';
      }else
	s += '0';
    }
    if(n==0)cout<<s<<endl;
    else cout<<"NA"<<endl;
  }
}

C++: #include<iostream>
#include<string>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

string itos(long long n){
	string res="";
	while(n/2){
		res=(char)(n%2+'0')+res;
		n/=2;
		if(n==1){
			res='1'+res;
		}
	}
	return res;
}

string dotos(int x){
	string res="";
	if(x>=5000){
		res+='1';
		x-=5000;
	}else{
		res+='0';
	}
	if(x>=2500){
		res+='1';
		x-=2500;
	}else{
		res+='0';
	}
	if(x>=1250){
		res+='1';
		x-=1250;
	}else{
		res+='0';
	}
	if(x>=625){
		res+='1';
		x-=625;
	}else{
		res+='0';
	}
	if(x>0)res="NA";
	return res;
}

void print(double x){
	string res="";
	long long re=(long long)x;
	int dd=(int)((x-re)*10000);
	res=itos(re)+"."+dotos(dd);
	int size=itos(re).size();
	if(size<8){
		rep(i,8-size){
			res='0'+res;
		}
	}else if(size>8){
		res="NA";
	}
	if(dotos(dd)=="NA"){
		res="NA";
	}
	cout<<res<<endl;
	return;
}

int main(){
	double num;
	while(cin>>num,num>=0){
		print(num);
	}
	return 0;
}