Hi all,

I need some simple advice...

I have a hexadecimal number that is created by two variables, num and dec. where num represent values 0-360 while dec are the decimal values 0-99. The most significant bits are not used in each numbers so I cut these off. For example, if num is f010 and dec = fe02 it means that the total number is 10.02. To print this out I do the following:

sprintf (buff1, "%x", *num);

sprintf (buff2, "%x", *dec);

printf("whole number: %s.%s ", buff1+(strlen(buff1)-3), buff2+(strlen(buff2)-2));

>> whole number: 010.02

Now my problem is to take this number 10.02 and add it to another number.

What is the easiest way to convert this into a float?

I’ve been trying different things but none of them have worked out well. I would be grateful for any input.

-Polly

I need some simple advice...

I have a hexadecimal number that is created by two variables, num and dec. where num represent values 0-360 while dec are the decimal values 0-99. The most significant bits are not used in each numbers so I cut these off. For example, if num is f010 and dec = fe02 it means that the total number is 10.02. To print this out I do the following:

sprintf (buff1, "%x", *num);

sprintf (buff2, "%x", *dec);

printf("whole number: %s.%s ", buff1+(strlen(buff1)-3), buff2+(strlen(buff2)-2));

>> whole number: 010.02

Now my problem is to take this number 10.02 and add it to another number.

What is the easiest way to convert this into a float?

I’ve been trying different things but none of them have worked out well. I would be grateful for any input.

-Polly