>
> It really don't make much sense:
> var_dump( PHP_FLOAT_MIN < 0 );
> var_dump( PHP_INT_MIN < 0 );
I quite agree that this is an inconsistency, but I guess that it's here to
stay now for BC reasons. What we can do is fix the doc.
> 2.2250738585072E-308
> This is negative.
It isn't, it is a strictly positive number with a negative exponent:
0.000(...)00022250738585072.
FLT_MIN is the smallest real near 0. Are you looking for -FLT_MAX?
> With IEEE754 floats, there are positive and negative zeros, so the range
> above and below 0 is the same.
It's interesting to know that - PHP_FLOAT_MAX is actually the smallest
representable floating point number (unlike - PHP_INT_MAX). It would be
great to document this as well.
I would propose to change the current documentation to:
PHP_FLOAT_MIN (float)
> Smallest representable POSITIVE floating point number. If you need the
> smallest representable floating point number, use - PHP_FLOAT_MAX.
> Available as of PHP 7.2.0.
What we could also do is introduce another constant to represent the actual
smallest possible float, but its naming would likely conflict with
PHP_FLOAT_MIN, and it does not bring much value, so I'm not sure whether
this is a good idea.
We did introduce a PHP_INT_MIN though, even though it was available as ~
PHP_INT_MAX, so it's worth mentioning.
Thoughts?
On Wed, 3 Apr 2019 at 13:50, Michael Wallner <mike@php.net> wrote: