mercredi 11 octobre 2023

Combining integer and float parts of a number in C++

I have three variables

uint_8 a = The integer value lets say 11111100,
uint_4 b = The fractional part of a. lets say .1001,
float c

where a is 8 bits and b is 4 bits.

Is there anyway that I combine a and b in c so that c has value 11111100.1001

I need the functions that can do it. A function that separates integer and fraction is possible. But the one that I is something that I am not finding at the moment.

Aucun commentaire:

Enregistrer un commentaire