Bug#746013: libmatheval: diff for NMU version 1.1.11+dfsg-1.2

2014-10-07 Thread Neil Williams
Control: tags 746013 + pending

Dear maintainer,

I've prepared an NMU for libmatheval (versioned as 1.1.11+dfsg-1.2) and
uploaded it to unstable with a fix for the compiler optimisation effects.

This diff extends the previous diff for i386 support.

Regards.
diff -Nru libmatheval-1.1.11+dfsg/debian/changelog libmatheval-1.1.11+dfsg/debian/changelog
--- libmatheval-1.1.11+dfsg/debian/changelog	2014-10-06 15:38:39.0 +0100
+++ libmatheval-1.1.11+dfsg/debian/changelog	2014-10-07 15:16:41.0 +0100
@@ -1,3 +1,15 @@
+libmatheval (1.1.11+dfsg-1.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add a fix to lib/xmath.c to limit the precision to
+within the range compatible with the current compiler
+optimisations so that the uncertain process of comparing
+floating point numbers can be used in the test suite.
+Completes the migration to guile-2.0 (Closes: #746013)
+  * Update symbols for the patched function
+
+ -- Neil Williams codeh...@debian.org  Tue, 07 Oct 2014 15:04:50 +0100
+
 libmatheval (1.1.11+dfsg-1.1) unstable; urgency=low
 
   * Non-maintainer upload.
diff -Nru libmatheval-1.1.11+dfsg/debian/libmatheval1.symbols libmatheval-1.1.11+dfsg/debian/libmatheval1.symbols
--- libmatheval-1.1.11+dfsg/debian/libmatheval1.symbols	2014-05-06 19:29:30.0 +0100
+++ libmatheval-1.1.11+dfsg/debian/libmatheval1.symbols	2014-10-07 15:15:38.0 +0100
@@ -48,6 +48,7 @@
  math_sec@Base 1.1.3
  math_sech@Base 1.1.3
  math_step@Base 1.1.3
+ math_truncate15@Base 1.1.11
  node_copy@Base 1.1.3
  node_create@Base 1.1.3
  node_derivative@Base 1.1.3
diff -Nru libmatheval-1.1.11+dfsg/debian/patches/004-arch-optimisation.patch libmatheval-1.1.11+dfsg/debian/patches/004-arch-optimisation.patch
--- libmatheval-1.1.11+dfsg/debian/patches/004-arch-optimisation.patch	1970-01-01 01:00:00.0 +0100
+++ libmatheval-1.1.11+dfsg/debian/patches/004-arch-optimisation.patch	2014-10-07 15:04:13.0 +0100
@@ -0,0 +1,73 @@
+Description: Compiler optimisation affects on floating point tests.
+ Truncate the precision of a returned double to 15 places.
+ This allows for compiler optimisations which may change the
+ comparison of floating point numbers on particular architectures.
+ .
+ libmatheval (1.1.11+dfsg-1.2) unstable; urgency=low
+ .
+   * Non-maintainer upload.
+   * Add a fix to lib/xmath.c to limit the precision to
+ within the range compatible with the current compiler
+ optimisations so that the uncertain process of comparing
+ floating point numbers can be used in the test suite.
+ Completes the migration to guile-2.0 (Closes: #746013)
+Author: Dave Pigott dave.pig...@linaro.org
+Bug-Debian: https://bugs.debian.org/746013
+
+---
+
+--- libmatheval-1.1.11+dfsg.orig/lib/xmath.c
 libmatheval-1.1.11+dfsg/lib/xmath.c
+@@ -19,8 +19,32 @@
+  * http://www.gnu.org/licenses/.
+  */
+ 
++#include stdio.h
+ #include xmath.h
+ 
++
++double
++math_truncate15(double x)
++{
++	/* 
++	 * Truncate the precision of a returned double to 15 decimal places
++	 * This is hacky, and as at the time of writing, is only required for
++	 * the coth function, which due to optimisation and floating point
++	 * width, gives a different result on i386 to all other platforms
++	 * At the moment we're dealing with an explicit 15 significant digits.
++	 * This could be generalised to a give me n digits of precision type
++	 * solution
++	 */
++	double d;
++	char s[128];
++
++	sprintf(s, %.15f, x);
++	sscanf(s, %lf, d);
++
++	return d; 
++}
++
++
+ double
+ math_cot(double x)
+ {
+@@ -81,7 +105,7 @@ math_coth(double x)
+ 	/* 
+ 	 * Calculate hyperbolic cotangent value.
+ 	 */
+-	return 1 / tanh(x);
++	return math_truncate15(1 / tanh(x));
+ }
+ 
+ double
+--- libmatheval-1.1.11+dfsg.orig/tests/functions.at
 libmatheval-1.1.11+dfsg/tests/functions.at
+@@ -335,7 +335,7 @@ AT_DATA([function.scm],
+ (display (evaluator-evaluate-x f 1))
+ ]])
+ 
+-AT_CHECK([matheval.sh function.scm], [ignore], [1.3130352854993315], [ignore])
++AT_CHECK([matheval.sh function.scm], [ignore], [1.313035285499331], [ignore])
+ 
+ AT_DATA([function.scm],
+ [[
diff -Nru libmatheval-1.1.11+dfsg/debian/patches/series libmatheval-1.1.11+dfsg/debian/patches/series
--- libmatheval-1.1.11+dfsg/debian/patches/series	2014-10-06 15:47:53.0 +0100
+++ libmatheval-1.1.11+dfsg/debian/patches/series	2014-10-07 14:58:25.0 +0100
@@ -1,2 +1,3 @@
 002-skip-docs.patch
 003-guile2.0.patch
+004-arch-optimisation.patch


Bug#746013: libmatheval: diff for NMU version 1.1.11+dfsg-1.2

2014-10-07 Thread Julian Taylor
On 07.10.2014 16:21, Neil Williams wrote:
 Control: tags 746013 + pending
 
 Dear maintainer,
 
 I've prepared an NMU for libmatheval (versioned as 1.1.11+dfsg-1.2) and
 uploaded it to unstable with a fix for the compiler optimisation effects.
 
 This diff extends the previous diff for i386 support.
 
 Regards.
 

please upload such hacky patches to delayed so I can override it with
something proper if I find the time...

the rounding issue can be solved much simpler by using appropriate C
types or putting an error on the tests.
Also you shouldn't just add a new debian specific symbol to a library
... (or was this forwarded upstream?)

but still thanks for handling the issue which I have been neglecting for
too long.


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org