To convert double to binary, you need to call Double.doubleToLongBits(x)and Long.toBinaryString(x).
So you can try String binary = Long.toBinaryString( Double.doubleToLongBits(0.1) );
To get the full 64-bit representation, you would need to add up to the 0th number.
Edit
Since you asked for the C version, I will try to add one (although I am not a C expert, so I could skip something like the std lib functions):
#include <stdio.h>
#include <stdint.h>
union binary {
double d;
uint64_t l;
} binary;
int main() {
union binary b;
b.d = 0.1;
uint64_t bin = b.l;
char c[65];
c[64] = '\0';
for( int i = sizeof(uint64_t) * 8 - 1; i >= 0; i--) {
if( bin & 1 ) {
c[i]='1';
} else {
c[i]='0';
}
bin >>= 1;
}
printf("%s\n",c);
return 0;
}
union, double 64- (aka long long). , , , , , 1.
, : double dbl = 0.1; uint64_t bin = *((uint64_t*)(&dbl)); ( , -, , ).
: , (.. ), .