summaryrefslogtreecommitdiff
path: root/source/dng_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/dng_utils.h')
-rw-r--r--source/dng_utils.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/dng_utils.h b/source/dng_utils.h
index d87de51..691f0b9 100644
--- a/source/dng_utils.h
+++ b/source/dng_utils.h
@@ -18,6 +18,7 @@
/*****************************************************************************/
+#include <cmath>
#include <limits>
#include "dng_classes.h"
@@ -708,12 +709,12 @@ inline void DNG_HSVtoRGB (real32 h,
if (s > 0.0f)
{
+ if (!std::isfinite(h))
+ ThrowProgramError("Unexpected NaN or Inf");
+ h = std::fmod(h, 6.0f);
if (h < 0.0f)
h += 6.0f;
- if (h >= 6.0f)
- h -= 6.0f;
-
int32 i = (int32) h;
real32 f = h - (real32) i;