From c20ee1a7f5a6f77b4005cbe1ff3f150c711ae088 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Thu, 23 Feb 2023 00:07:10 +0000 Subject: [PATCH] Use double type to improve floating point accuracy. --- src/tags_int.cpp | 2 +- .../issue_1912_poc.jpg.out | Bin 3998 -> 4000 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tags_int.cpp b/src/tags_int.cpp index 1fb67e34..6df9adb9 100644 --- a/src/tags_int.cpp +++ b/src/tags_int.cpp @@ -2612,7 +2612,7 @@ std::ostream& print0x0007(std::ostream& os, const Value& value, const ExifData*) } std::ostringstream oss; oss.copyfmt(os); - const double t = 3600 * value.toFloat(0) + 60 * value.toFloat(1) + value.toFloat(2); + const double t = 3600.0 * value.toFloat(0) + 60.0 * value.toFloat(1) + value.toFloat(2); enforce(std::isfinite(t), "Non-finite time value"); int p = 0; const double fraction = std::fmod(t, 1); diff --git a/test/data/test_reference_files/issue_1912_poc.jpg.out b/test/data/test_reference_files/issue_1912_poc.jpg.out index 74e89b02d0551a2040095f7c769bf6d5979cd018..8cbd375eb06964a8fbf341350520f0d429e6f18c 100644 GIT binary patch delta 20 bcmbOyzd(M&R6cf7Gb>{=J+sZT_*fVLL=Oe2 delta 18 ZcmZ1=KTm$cR6bTC11kfA&2#uz7y&sb1v3Bu