Package: exiftags
Version: 0.98-1.1+etch1
Severity: normal
Tags: patch
The number of decimal digits used to display GPS values is computed
wrongly. The base-10 logarithm needs to be rounded up to get the
correct number.
E.g., in an example I had n=297, d=5. Since log10(d)=0.69..., it's
rounded to 0, i.e. the fraction is displayed with no decimals (59).
Rounding up the logarithm to 1 will correctly display 1 decimal
(59.4).
--- exiftags-0.98/exifgps.c.orig 2008-07-27 12:12:21.000000000 +0200
+++ exiftags-0.98/exifgps.c 2008-07-27 12:13:23.000000000 +0200
@@ -286,7 +286,7 @@
deg = (double)n / (double)d;
if (d != 1)
sprintf(fmt, "%%s %%.%df%%s ",
- (int)log10((double)d));
+ (int)ceil(log10((double)d)));
}
/* Minutes. */
@@ -301,7 +301,7 @@
} else {
min = (double)n / (double)d;
if (d != 1) {
- sprintf(buf, "%%.%df'", (int)log10((double)d));
+ sprintf(buf, "%%.%df'",
(int)ceil(log10((double)d)));
strcat(fmt, buf);
} else
strcat(fmt, "%.f'");
@@ -323,7 +323,7 @@
} else {
sec = (double)n / (double)d;
if (d != 1) {
- sprintf(buf, " %%.%df", (int)log10((double)d));
+ sprintf(buf, " %%.%df",
(int)ceil(log10((double)d)));
strcat(fmt, buf);
} else
strcat(fmt, " %.f");
@@ -368,10 +368,10 @@
if (!d) break;
if (!i)
- sprintf(fmt, "%%02.%df", (int)log10((double)d));
+ sprintf(fmt, "%%02.%df",
(int)ceil(log10((double)d)));
else
sprintf(fmt, ":%%02.%df",
- (int)log10((double)d));
+ (int)ceil(log10((double)d)));
snprintf(buf, 8, fmt, (double)n / (double)d);
strcat(prop->str, buf);
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]