Le 01/02/2012 18:26, William Stein a écrit :
On Wed, Feb 1, 2012 at 4:19 AM, Julien Puydt<julien.pu...@laposte.net>  wrote:
So the tests should be modified not to depend on the specific implementation
: they're currently testing equality of floats!

See http://trac.sagemath.org/sage_trac/ticket/10952

Oh, dear! That is almost wonderful!

This is wonderful because it looks so much like what is needed : the attached patch doesn't break the tests on x86_64 test, and it fixes three of the four tests on ARM.

The fourth is the reason for the *almost* :

sage -t --long "devel/sage/sage/symbolic/expression.pyx"
**********************************************************************
File "/home/jpuydt/sage-4.8/devel/sage/sage/symbolic/expression.pyx", line 6256:
    sage: SR(10.0r).gamma()  # rel tol 1e-15
Out of tolerance 362880.0 vs 362880.0
#0: simplify_sum(expr='sum(q^k,k,0,inf))
#1: simplify_sum(expr=a*'sum(q^k,k,0,inf))
**********************************************************************
1 items had failures:
   1 of  18 in __main__.example_142
***Test Failed*** 1 failures.
For whitespace errors, see the file /home/jpuydt/.sage//tmp/expression_10389.py
         [167.8 s]

Would the calculation of the relative error involve a division by zero when the two quantities are really equal?

Snark on #sagemath

PS: I chose "rel tol 1e-15" because a double precision of 53 binary digits corresponds to about 15.95 decimal digits.

--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
diff --git a/sage/functions/other.py b/sage/functions/other.py
--- a/sage/functions/other.py
+++ b/sage/functions/other.py
@@ -508,7 +508,7 @@
             sage: gamma1(x/2)(x=5)
             3/4*sqrt(pi)
 
-            sage: gamma1(float(6))
+            sage: gamma1(float(6))  # rel tol 1e-15
             120.0
             sage: gamma1(x)
             gamma(x)
diff --git a/sage/interfaces/maxima_abstract.py b/sage/interfaces/maxima_abstract.py
--- a/sage/interfaces/maxima_abstract.py
+++ b/sage/interfaces/maxima_abstract.py
@@ -1592,7 +1592,7 @@
         
             sage: float(maxima("3.14"))
             3.1400000000000001
-            sage: float(maxima("1.7e+17"))
+            sage: float(maxima("1.7e+17"))  # rel tol 1e-15
             1.7e+17
             sage: float(maxima("1.7e-17"))
             1.6999999999999999e-17
diff --git a/sage/rings/arith.py b/sage/rings/arith.py
--- a/sage/rings/arith.py
+++ b/sage/rings/arith.py
@@ -3058,7 +3058,7 @@
         0.000000000000000
         sage: binomial(-2.,3)
         -4.00000000000000
-        sage: binomial(0.5r, 5)
+        sage: binomial(0.5r, 5)  # rel tol 1e-15
         0.02734375
 
     Test symbolic and uni/multivariate polynomials::
diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
--- a/sage/symbolic/expression.pyx
+++ b/sage/symbolic/expression.pyx
@@ -6253,7 +6253,7 @@
             1
             sage: SR(10).gamma()
             362880
-            sage: SR(10.0r).gamma()
+            sage: SR(10.0r).gamma()  # rel tol 1e-15
             362880.0
             sage: SR(CDF(1,1)).gamma()
             0.498015668118 - 0.154949828302*I

Reply via email to