Use double type to improve floating point accuracy.

This commit is contained in:
Kevin Backhouse 2023-02-23 00:07:10 +00:00 committed by Rosen Penev
parent 79bf4d0b1e
commit c20ee1a7f5
2 changed files with 1 additions and 1 deletions

View File

@ -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::overflow_error>(std::isfinite(t), "Non-finite time value");
int p = 0;
const double fraction = std::fmod(t, 1);