[med-svn] [dcmtk] 01/06: Add patch to fix rounding errors
Gert Wollny
gewo at moszumanska.debian.org
Thu Jun 22 16:48:23 UTC 2017
This is an automated email from the git hooks/post-receive script.
gewo pushed a commit to branch master
in repository dcmtk.
commit 24d0a61e9197add4fe329f3a892bd3d7a2351537
Author: Gert Wollny <gewo at debian.org>
Date: Thu Jun 22 07:54:59 2017 +0000
Add patch to fix rounding errors
---
debian/patches/09_round_time.patch | 18 ++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 19 insertions(+)
diff --git a/debian/patches/09_round_time.patch b/debian/patches/09_round_time.patch
new file mode 100644
index 0000000..f4f3464
--- /dev/null
+++ b/debian/patches/09_round_time.patch
@@ -0,0 +1,18 @@
+Author: Gert Wollny <gewo at debian.org>
+Description: work around numerical instability by rounding the time in seconds
+ to the six decimal points supported in dicom
+Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859204
+
+--- a/ofstd/libsrc/oftime.cc
++++ b/ofstd/libsrc/oftime.cc
+@@ -491,6 +491,10 @@
+ {
+ /* compute number of seconds since 00:00:00 */
+ double result = ((OFstatic_cast(double, hour) - timeZone) * 60 + OFstatic_cast(double, minute)) * 60 + second;
++
++ /* Dicom supports only six decimal digits, but floating point operations might introduce errors */
++ result = round(result * 1000000.0) / 1000000.0;
++
+ /* normalize the result to the range [0.0,86400.0[ */
+ if (normalize)
+ result -= OFstatic_cast(double, OFstatic_cast(unsigned long, result / 86400) * 86400);
diff --git a/debian/patches/series b/debian/patches/series
index c7ae910..0ae3d31 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@
06_soversion_abi.patch
07_dont_export_all_executables.patch
08_remove_system_processor.patch
+09_round_time.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/dcmtk.git
More information about the debian-med-commit
mailing list