Consider below example

Convert 2.625 to binary.

We will consider the integer and fractional part separately.

The integral part is easy, 2 = 10. 

For the fractional part:

0.625   ร— 2 =   1.25    1   Generate 1 and continue with the rest.
0.25    ร— 2 =   0.5     0   Generate 0 and continue.
0.5     ร— 2 =   1.0     1   Generate 1 and nothing remains.

So 0.625 = 0.101, and 2.625 = 10.101.

See this link for more information.

Answer from Govind Prabhu on Stack Overflow
๐ŸŒ
Kyledewey
kyledewey.github.io โ€บ comp122-fall17 โ€บ lecture โ€บ week_2 โ€บ floating_point_interconversions.html
Converting Between Decimal and Binary Floating-Point Numbers
Step-by-step instructions follow which discuss how to convert from decimal floating-point values to an equivalent binary representation in binary32. These instructions are similar to those presented here, though the step numbers are not one-to-one (the instructions below use more steps, though the process is the same).
๐ŸŒ
Binary Convert
binaryconvert.com โ€บ convert_float.html
Float (IEEE754 Single precision 32-bit) Converter
Online binary converter. Supports all types of variables, including single and double precision IEEE754 numbers
Discussions

floating point - How to convert float number to Binary? - Stack Overflow
Can anyone please tell me how can I convert this float number: 12.25 to binary? I know how to convert the "12" but not the 0.25 Any help is much appreciated. Thanks More on stackoverflow.com
๐ŸŒ stackoverflow.com
Converting decimal float values to binary form using C or C++
Firstly I'd try to work out what the question meant. For example, 3.25 could be represented in binary as 11.01 But that's not how computers store floating point numbers. (They have a 'mantissa' and an 'exponent' instead.) So assuming I wanted to print the actual data C++ is using, what I'd normally do is Google: c++ print float as binary That would take me to a StackOverflow page. Then I'd start the real work of trying to figure out what the answers mean... More on reddit.com
๐ŸŒ r/AskProgramming
5
0
September 24, 2023
Convert From binary to Float in C
uint32_t temp; float val; temp = (uint32_t)raw_bytes[0]; temp |= (uint32_t)raw_bytes[1] << 8; temp |= (uint32_t)raw_bytes[2] << 16; temp |= (uint32_t)raw_bytes[3] << 24; memcpy(&val, &tmp, sizeof(val)); or you may need to combine them in the reverse order depending on platform/communication protocol endian. More on reddit.com
๐ŸŒ r/C_Programming
18
1
May 3, 2021
float to binary conversion
You might want to have a look at the struct module? It will give you a bytes representation of the float which you can then take apart with bit masking if you want. More on reddit.com
๐ŸŒ r/learnpython
5
5
April 21, 2022
People also ask

What is Float to Binary?
Float to Binary is a free online converter that convert floating-point numbers to binary ieee 754 format. visualize how decimals are stored in binary. It works directly in your browser with no installation required. This tool is part of our Binary Tools collection.
๐ŸŒ
onlinetoolz.ai
onlinetoolz.ai โ€บ home โ€บ binary tools โ€บ float to binary
Float to Binary - Free Online Converter | OnlineToolz
How do I convert data with Float to Binary?
Using Float to Binary is simple: 1) Paste or type your input data in the input field. 2) The conversion happens automatically or click the convert button. 3) Copy the converted output or download it as a file.
๐ŸŒ
onlinetoolz.ai
onlinetoolz.ai โ€บ home โ€บ binary tools โ€บ float to binary
Float to Binary - Free Online Converter | OnlineToolz
Is Float to Binary free to use?
Yes, Float to Binary is completely free with no limits. No signup, no registration, and no hidden fees. Use it unlimited times for all your binary tools needs.
๐ŸŒ
onlinetoolz.ai
onlinetoolz.ai โ€บ home โ€บ binary tools โ€บ float to binary
Float to Binary - Free Online Converter | OnlineToolz
๐ŸŒ
Numeral-systems
numeral-systems.com โ€บ ieee-754-converter
IEEE-754 floating point numbers converter
This calculator can be used to convert decimal numbers to a binary floating point number in IEEE-754 format or vice versa.
๐ŸŒ
VisibleEarth
h-schmidt.net โ€บ FloatConverter โ€บ IEEE754.html
IEEE-754 Floating Point Converter
This page allows you to convert between the decimal representation of a number (like "1.02") and the binary format used by all modern CPUs (a.k.a. "IEEE 754 floating point").
๐ŸŒ
Log2Base2
log2base2.com โ€บ number-system โ€บ float-to-binary-conversion.html
How to convert float number to Binary?
To convert the fractional part to binary, multiply fractional part with 2 and take the one bit which appears before the decimal point. Follow the same procedure with after the decimal point (.) part until it becomes 1.0. ... Here, the fractional part 0.32 which is repeating again.
Find elsewhere
๐ŸŒ
OnlineToolz
onlinetoolz.ai โ€บ home โ€บ binary tools โ€บ float to binary
Float to Binary - Free Online Converter | OnlineToolz
January 1, 2024 - Convert floating-point numbers to binary IEEE 754 format. Visualize how decimals are stored in binary. Free, no signup required.
๐ŸŒ
Wikihow
wikihow.com โ€บ education and communications โ€บ studying โ€บ mathematics โ€บ conversion aids โ€บ how to convert a number from decimal to ieee 754 floating point representation
How to Convert a Number from Decimal to IEEE 754 Floating Point Representation
December 15, 2025 - Take the number that you would like to convert, and take apart the number so you have a whole number portion and a decimal number portion. This example will use the number 85.125.
๐ŸŒ
Omni Calculator
omnicalculator.com โ€บ other โ€บ floating-point
Floating-Point Calculator
August 7, 2025 - The floating-point calculator converts the binary representation of 32-bit floating-point numbers into real numbers and back again according to the IEEE754 standard. It has handy features like conversion to hexadecimal representations, calculation ...
๐ŸŒ
Baseconvert
baseconvert.com
Base Convert
Online number base converter for binary, hexadecimal, octal, decimal, roman numerals, balanced ternary, negabinary, factorial, bijective, and any radix. Supports high precision and fractional values.
๐ŸŒ
Exploring Binary
exploringbinary.com โ€บ home โ€บ decimal to floating-point converter
Decimal to Floating-Point Converter - Exploring Binary
June 1, 2018 - This is a decimal to binary floating-point converter. It will convert a decimal number to its nearest single-precision and double-precision IEEE 754 binary floating-point number, using round-half-to-even rounding (the default IEEE rounding mode). It is implemented with arbitrary-precision arithmetic, so its conversions are correctly rounded.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-program-to-convert-floating-to-binary
Convert Floating to Binary - Python - GeeksforGeeks
July 11, 2025 - It is useful for educational purposes, debugging floating-point operations and understanding how numbers are stored in memory. While less efficient than struct or numpy, it provides a clear breakdown of the conversion process. ... n = 10.75 sign = '0' if n >= 0 else '1' n= abs(n) # get integer and fractional parts int_part = int(n) frac_part = n - int_part # convert integer part to binary int_bin = bin(int_part)[2:] # convert fractional part to binary frac_bin = [] while frac_part and len(frac_bin) < 23: frac_part *= 2 bit = int(frac_part) frac_bin.append(str(bit)) frac_part -= bit # normalize exponent = len(int_bin) - 1 mantissa = int_bin[1:] + ''.join(frac_bin) # adjust mantissa to 23 bits mantissa = (mantissa + '0' * 23)[:23] # exponent with bias (127) exponent_bin = f"{exponent + 127:08b}" # IEEE 754 Binary Representation res = sign + exponent_bin + mantissa print(res)
๐ŸŒ
Toolhelper
toolhelper.cn โ€บ en โ€บ Digit โ€บ FractionConvert
IEEE 754 Floating Point Converter - Hammer Online Tools
This tool is an online IEEE 754 floating point conversion tool, providing the conversion of floating point numbers to binary and hexadecimal in single precision and double precision formats.
๐ŸŒ
Reddit
reddit.com โ€บ r/askprogramming โ€บ converting decimal float values to binary form using c or c++
r/AskProgramming on Reddit: Converting decimal float values to binary form using C or C++
September 24, 2023 -

I've done writing the program which inputs integer decimal values and displays binary form of that input value in c/c++, but the original assignment was for float value inputs. So does anybody have any idea how to do that ?

This is the program that i've written :

#include <stdio.h>

int decimaltobinary(int decimal_number){

int binary[32];

int i =0;

while (decimal_number>0){

binary[i]=decimal_number%2;

decimal_number=decimal_number/2;

i++;

}

for (int k=i-1;k>=0;k--){

printf("%d",binary[k]);

}

return 0;

}

int main(void){

int number;

printf("Enter the number : ");

scanf("%d",&number);

decimaltobinary(number);

}

๐ŸŒ
Ada Computer Science
adacomputerscience.org โ€บ concepts โ€บ number_floating_point_conversions
Floating point number conversions
Join Ada Computer Science, the free, online computer science programme for students and teachers. Learn with our computer science resources and questions.
๐ŸŒ
Quora
quora.com โ€บ How-do-you-convert-a-floating-number-to-binary
How to convert a floating number to binary - Quora
Answer (1 of 5): You must be familiar with the IEEE 754 format for floating-point numbers to do this. See IEEE 754-1985 - Wikipedia for a good explanation. Note that for a 32-bit float the leftmost bit is the sign bit (0 for positive, 1 for negative), the next 8 bits are for the exponent (with a ...
๐ŸŒ
Baseconvert
baseconvert.com โ€บ ieee-754-floating-point
IEEE 754 Floating Point Converter - Base Convert
Online number base converter for binary, hexadecimal, octal, decimal, roman numerals, balanced ternary, negabinary, factorial, bijective, and any radix. Supports high precision and fractional values.
๐ŸŒ
Quora
quora.com โ€บ How-do-you-convert-a-floating-point-number-to-binary
How to convert a floating-point number to binary - Quora
Not to some representation like an IEEE float? Convert the decimal part to binary, then the fractional part to binary. Simple sample, 31.4E-1 Whole part: 3; Fractional part: .14 You would choose how many digits...
๐ŸŒ
101 Computing
101computing.net โ€บ home โ€บ python challenges โ€บ floating point binary converter
Floating Point Binary Converter - 101 Computing
August 11, 2024 - The following conversion tool will help you work out the formula used to convert a normalised floating point binary number to a decimal number.
๐ŸŒ
Evanw
evanw.github.io โ€บ float-toy
Float Toy
Click on a cell below to toggle bit values, or edit the hex or decimal values directly. Use this to build intuition for the IEEE floating-point format.