On Wed, Apr 3, 2019 at 4:52 AM Benjamin Morel <benjamin.mo...@gmail.com> wrote:
> I just used PHP_FLOAT_MIN for the first time, and was surprised that it is > the smallest **positive** number representable. Is this expected? > > This is unlike PHP_INT_MIN, which is the absolute smallest representable > integer, and as such is negative: > > echo PHP_INT_MIN; // -9223372036854775808 > echo PHP_FLOAT_MIN; // 2.2250738585072E-308 > > If it is intended, maybe the doc > <https://www.php.net/manual/en/reserved.constants.php> should be clear > about this, at the moment it is just: > > Smallest representable floating point number. > > > Which is confusing IMO. > > Perhaps confusing, but not without precedent. See the C++ definitions for ::min() and ::lowest() on https://en.cppreference.com/w/cpp/types/numeric_limits. std::numeric_limits<double>::min() is a positive value very near zero. std::numeric::limits<double>::lowest() is a very large negative value. -Sara