3 ms·
In standard C you have nextafterf(3) that gives the next float and allows to traverse them starting from 0: #include <math.h> // nextafterf #include
by enriquto 4y ago
In standard C you have nextafterf(3) that gives the next float and allows to traverse them starting from 0:
#include <math.h> // nextafterf
#include <stdio.h> // printf
int main()
{
long n = 1;
float f = 0;
while (f <= 1)
{
f = nextafterf(f, 2);
n = n + 1;
}
printf("%ld\n", n);
return 0;
}