[英]IEEE-754: cardinality of the set of rational numbers
有理数集的基数是什么?这些有理数具有与单精度IEEE-754兼容的浮点格式的精确表示?
有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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.