[types] Fix check for finite numbers on Linux

On Linux we were merely checking whether f is finite, but that does
not cover the case f=NaN.
=> use isfinite instead which checks whether f != inf && f != NaN
v0.27.3
Dan Čermák 7 years ago
parent c5d46ac440
commit 6fd1c5b4bf

@ -674,11 +674,10 @@ namespace Exiv2 {
Rational floatToRationalCast(float f)
{
#if defined(_MSC_VER) && _MSC_VER < 1800
#define isinf(x) (!_finite(x))
#elif __APPLE__
#define isinf(x) (isinf(x) || isnan(x))
if (!_finite(f)) {
#else
if (!std::isfinite(f)) {
#endif
if (isinf(f)) {
return Rational(f > 0 ? 1 : -1, 0);
}
// Beware: primitive conversion algorithm

Loading…
Cancel
Save