News for hackers. Stuff that matters.

Pomax

Re:PHP 5.3.3 hangs on numeric value 2.2250738585072011e-308 on Tuesday January 04, 2011 @12:05PM (#2067614)
This is the nature of floating point numbers: they're not exactually "exact" at all. Converting a fixed fraction decimal number into a floating point means turning an exact number into its best approximation. In order to get the approximation as close as possible to the original number, a floating point conversion algorithm will perform several runs until the error between the original number and the floating point representation is smaller than some very small value. This leads to problems when either the error can't get smaller than the required precision, or when the error doesn't decrease per iteration. In both cases an algorithm that doesn't have error detection will be stuck in an infinite loop.