# An algorithm to convert float number to binary representation

I want to know the algorithm of converting a given float (e.g, 3.14) to binary in the memory.

As you know; the floating number is calculated as:

$value = (-1)^ {sign} \times 2^{exponent-127} \times fraction$

where

$exponent = 2^2 + 2^3 + 2^4 + 2^5 + 2^6$

$fraction = 1 + 2^{-2}$