How come subtracting 1 from float max returns a sensible value, but adding 1 to float min returns 1?
I thought that if you added or subtracted a value smaller than the epsilon for that particular magnitude, then nothing would happen and there would be no increase or decrease.
Here is the code I compiled with g++ with no flags and ran on x86_64.
#include <limits>#include <iostream>int main() { float min = std::numeric_limits<float>::min() + 1; float max = std::numeric_limits<float>::max() - 1; std::cout << min << std::endl << max << std::endl; return 0;}
Outputs this:
13.40282e+38
I would expect it to output this:
-3.40282e+38 3.40282e+38