[GD-General] FLT_MIN
Brought to you by:
vexxed72
From: Pierre T. <p.t...@wa...> - 2003-01-02 22:57:28
|
Here's something I don't get.... I was looking for the smallest floating-point value F such as F^2 doesn't underflow. So, I wrote something like : F^2 = FLT_MIN ; => F = sqrtf ( FLT_MIN ) ; Then, as a test, I wrote : const float HalfSqrtFMin = sqrtf(FLT_MIN) * 0.5f; const float f = HalfSqrtFMin*HalfSqrtFMin; I was expecting f to be zero due to underflow. Yet it wasn't. That was my first clue something weird was going on. So I investigated a bit more and found that the floating-point value I was looking for was 1.40130e-045, which gives zero once squared. This is the floating-point value whose binary representation is 0x00000001. I've always thought FLT_MIN was the "min positive value" (as stated in Float.h). What the hell is that number then ? I'm sure I'm missing something obvious.... Pierre PS: http://www.codercorner.com/FPU.jpg |