#define _CRT_SECURE_NO_WARNINGS
#include <cfloat> // _controlfp
#include <cmath> // sqrt
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;
void print_bits(const double& value){
auto raw=*(unsigned long long*)&value;
auto len=sizeof(raw)<<3;
auto str=string(len,(char)0);
for_each(begin(str),end(str),[&raw](char&chr){
chr=(raw&1)?'1':'0';
raw>>=1;
});
reverse(begin(str),end(str));
cout<<"0b"<<str<<endl;
}
void print_bits(const float& value){
auto raw=*(unsigned int*)&value;
auto len=sizeof(raw)<<3;
auto str=string(len,(char)0);
for_each(begin(str),end(str),[&raw](char&chr){
chr=(raw&1)?'1':'0';
raw>>=1;
});
reverse(begin(str),end(str));
cout<<"0b"<<str<<endl;
}
#define _PC_64 0x00000000
#define _PC_53 0x00010000
#define _PC_24 0x00020000
#define _MCW_PC 0x00030000
int main(){
_controlfp(_PC_24,_MCW_PC);
print_bits(sqrt((float)2));
print_bits(sqrt((double)2));
_controlfp(_PC_53,_MCW_PC);
print_bits(sqrt((float)2));
print_bits(sqrt((double)2));
_controlfp(_PC_64,_MCW_PC);
print_bits(sqrt((float)2));
print_bits(sqrt((double)2));
}
// VCにて(x86)
//0b00111111101101010000010011110011
//0b0011111111110110101000001001111001100000000000000000000000000000
//0b00111111101101010000010011110011
//0b0011111111110110101000001001111001100110011111110011101111001101
//0b00111111101101010000010011110011
//0b0011111111110110101000001001111001100110011111110011101111001101