Closed
Description
glm::isfinite
from compatibility.inl
returns false
for float
or double
values that are less than or equal to 0.
The bug is in line 49:
return x >= std::numeric_limits<genType>::min() && x <= std::numeric_limits<genType>::max();
For floating point types with denormalization (see std::numeric_limits::has_denorm
) std::numeric_limits::min()
returns the smallest finite number greater than 0 that the type can represent instead of the smallest finite number overall.
The following should give the correct result for integer and floating point types:
if (std::numeric_limits<genType>::is_integer || std::denorm_absent == std::numeric_limits<genType>::has_denorm)
{
return std::numeric_limits<genType>::min() <= x && std::numeric_limits<genType>::max() >= x;
}
else
{
return -std::numeric_limits<genType>::max() <= x && std::numeric_limits<genType>::max() >= x;
}