Convert scientific notation decimal number to binary
There is more than one correct approach to convert the number.  The former is a correct algorithm for the problem.  This kind of base conversion would usually be implemented in a library for the programming language you are using.  There might be many such implementations out there, and I don't know what all of them are doing.

I would not recommend the latter approach, as I expect computing $2^\alpha$ where $\alpha=31 \log_2 10$ will be painful.

See also The math behind converting from any base to any base without going through base 10? and https://math.stackexchange.com/q/48968/14578 and https://en.wikipedia.org/wiki/Positional_notation#Base_conversion and https://en.wikipedia.org/wiki/Binary_number#Conversion_to_and_from_other_numeral_systems.