Convert a Decimal Number into IEEE 754 format [no code please]

Hi,
I am trying to code a C++/C program that can convert a decimal integer or floating point number int IEEE 754 equivalent of any binary representation of numbers. I am able to do the following:
>Convert an integer into IEEE 754 whether its -ve or not.

I need a convenient logic that will convert an floating point number to equivalent binary as an array. Please do not post the code. Just suggest appropriate algorithm.

Thanks
You could use the compiler's casting functions. Or are you wanting to do this manually bit-wise?
I want to do it manually. From the scratch.
closed account (o1vk4iN6)
Well its such a trivia thing to do i wouldnt call it an algorithm.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct {
int sign : 1;
int exponent : 8;
int fraction : 23;
}
int input;
if negative
   Sign = 1
   input = -input
else
   sign = 0

get decimal place and make exponent equal it

fraction = input

Topic archived. No new replies allowed.