Here, i subtract 128.0 and 129.0 from a float variable 2M times.
#include "stdafx.h"
#include<stdlib.h> //is this the problem? Or am i doing something wrong?
int main()
{
float d1=3.0e9;
printf("\n before: %f \n",d1);
for(int i=0;i<2000000;i++) d1=d1-128.0; //doesnt change!
printf("\n after : %f \n",d1);
for(int i=0;i<2000000;i++) d1=d1-129.0; //does change!
printf("\n after2: %f \n",d1);
//is 129 is the minimum step for sub/add ? Isnt this wrong?
//Is this about exponential part 10^9 ?
getchar();
return 0;
}
Output:

Question: Why this float does not change by adding/subbing by operands smaller then 129? Because i choose the initial float value 3.0e9 ?
When i choose initial value 3.0e10, both initialization and both subtractions dont work.
When i choose initial value 3.0e8, minimum change is 17. So 16 doesnt change. 🙁
So, thanks for answers, . When initial value get smaller, minimum step gets smaller according to precision.
VC++ 2010 express . windows xp 32 bit. pentium-m
We can understand what’s going on by looking at the anatomy of a 32-bit float. The value
3.0E9in IEEE754 format is0x4F32D05E, with exponent value 31 (you can use this online calculator to find the value).Now we have 23 sub-unity binary digits left for the mantissa. That means that the smallest increment, i.e. the difference between to adjacent values of the mantissa, is a number with binary scale 31 − 23 = 8. Since 128 is 27, we see that it is just small enough to fall off the end of the mantissa, while 129 is large enough to be visible.