有2139095039个有限的正浮点数。有有限的负浮点数。
您要将+0.0和-0.0包括为两项还是一项?根据答案的不同,总数为2 * 2139095039 + 2或2 * 2139095039 +1,分别为4278190080或4278190079。
2139095039编号的来源:
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void) {
float f = FLT_MAX;
unsigned int i;
memcpy(&i, &f, 4);
printf("%u\n", i);
}
Run Code Online (Sandbox Code Playgroud)