Given a floating point number, I would like to print the significand and the exponent in binary. This is for teaching purposes.

I guess I can use mathematical functions to get them but on one hand it seems that this cannot be the easiest way and on the other hand it may introduce some error.