Skip to content

Commit b3ca98c

Browse files
Fix Exif.NikonFl7.FlashCompensation pretty print
1 parent 8ebf10f commit b3ca98c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/nikonmn_int.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,14 +2929,14 @@ fmountlens[] = {
29292929

29302930
if (temp == 0)
29312931
os << 0;
2932-
else if ( std::numeric_limits<float>::min() > temp || temp > std::numeric_limits<float>::max() )
2932+
else if (!std::isfinite(temp))
29332933
os << "(" << value << ")";
2934-
else if ( (int(temp)/temp) > 0.999 )
2935-
os << int(temp);
2936-
else if ( std::numeric_limits<float>::min() <= (temp*2) && (temp*2) <= std::numeric_limits<float>::max() && ((int(temp*2)/(temp*2)) > 0.999) )
2937-
os << int(temp)*2 << "/2";
2938-
else if ( std::numeric_limits<float>::min() <= (temp*3) && (temp*3) <= std::numeric_limits<float>::max() && ((int(temp*3)/(temp*3)) > 0.999) )
2939-
os << int(temp)*3 << "/3";
2934+
else if (std::abs(std::fmod(temp, 1)) < 0.001)
2935+
os << std::round(temp);
2936+
else if (std::abs(std::fmod(temp*2, 1)) < 0.001)
2937+
os << std::round(temp*2) << "/2";
2938+
else if (std::abs(std::fmod(temp*3, 1)) < 0.001)
2939+
os << std::round(temp*3) << "/3";
29402940
else
29412941
os << std::setprecision(3) << temp;
29422942

0 commit comments

Comments
 (0)