George George

George George

  • NA
  • 778
  • 0

float representation

Jun 18 2008 8:24 AM

Hello everyone,


In my knowledge, float could only be represented by 7 decimal bits. But why in debugger, I can see more than 7 decimal bits?

(in my sample, Result2 is of 9 bits, other than 7, why?)

[Code]
            float TotalBonus = 199.321F;
            float Worker1 = 100F;
            float Worker2 = 300F;

            //   Result1 49.83025 float
            float Result1 = TotalBonus * Worker1 / (Worker1 + Worker2);

            //   Result2 149.490753 float
            float Result2 = TotalBonus * Worker2 / (Worker1 + Worker2);
[/Code]


thanks in advance,
George


Answers (5)