什么最大整数,能够加 1 一个 float 类型可以在 C++ 中容纳?

What maximal integer, capable of adding 1 a float type can hold in c++?

假设我正在使用 float 来保存整数值并向其添加小的偏移量,大约 1 秒或 2 秒。在什么值 float 会停止变化?这个值的名称是什么?

IEEE 754 浮点变量 a 的最小正值 a == a+12^bits_precision,其中 bits_precision 比有效位中的位,可以用 std::numeric_limits<T>::digits.

找到

对于 32 位 float,这是 24;对于 64 位 double,这是 53(同样,在 IEEE 754 的非常常见的上下文中)。

Demo