Nie można zapisać wartości zmiennoprzecinkowej w strukturze pola bitowego

Mam strukturę

struct {
   u32 var1 :7;
   u32 var2 :4;
   u32 var3 :4;
   u32 var4 :1;
   u32 var5 :4;
   u32 var6 :7;
   u32 var7 :4;
   u32 var8 :1;
        } my_struct;

my_struct struct1[10];

for(int i=0;i<10; i++)
  {
    // left some portion
    struct1[i].var5= x;// where x is a float value retrieved from a database with sqlapi++ asDouble()

    cout<<"Value of x from db is:\t"<<x;   // prints 0.1 if it is stored, prints 2.4 if 2.4 is fed

    cout<<"Value of x stored in struct1 is:\t"<<struct1[i].var5;   // prints 0 instead of 0.1, prints 2 instead of 2.4
  }

Chcę przechowywać wartości zmiennoprzecinkowe, takie jak 0.1, 3.4, 0.8 w var5. Ale nie mogę tego zrobić. Czy ktoś może mi pomóc, jak mogę rozwiązać ten problem?

questionAnswers(5)

yourAnswerToTheQuestion