kas1e wrote:
hm, btw. with while (aa<1) i have on exit from while : 1.009999 (so, not exactly 1.00) but with fabs() i have 0.99999 (so, not exactly 1.00 agayn).
if both case i will have problems, i need exactly 1.00000 as last think. it is possible ?
becouse with fabs, of without, i need to do somethink after while for 1.0000 rezult.
Work in integer and have a scale factor to convert the integer to your required float at any time. For instance
float scaleF = 0.01;
int i;
for(i=0; i<=100; i++) {
float aa = scaleF*i;
/* do whatever with a here */
}
This will ensure that on each iteration your value of a is as close to ideal as possible.
If you can do without actual floating point, try fixed point using integers as chaoslord suggests.