On Mon, Mar 14, 2011 at 8:49 AM, David Kirkby <david.kir...@onetel.net> wrote: > On 14 March 2011 14:58, rjf <fate...@gmail.com> wrote: >> At the risk of pointing out the obvious, there are 2 well known >> tests for the closeness of two numbers. >> >> relative error and absolute error. >> >> abs( (a-b)/a) is relative error [assume a [or b] is not zero) and >> abs( a-b ) is absolute error. >> >> Defining another error measurement by "how many digits are the same >> when you print" >> is probably not very useful except if you are doing some kind of >> "look at me, let's be friends because we have the same color hair" >> test. > > I understand that, but the way the doctests work in Sage is quite > different. I'm very unimpressed with the way they are implemented > personally, but they look for a string, and ignore the significance of > that string. Stupid in my opinion, but that's how it is.
The reason it's this way is because these docstrings are as much for documentation as they are for tests. We want to have plenty of examples and at the same time ensure that the examples keep working. For some kinds of thinks, unit tests may make more sense, and we do have TEST blocks which are explicitly for testing where it makes sense to do do, e.g. abs(desired - actual) < tol. This just isn't very instructive do put in the documentation (relative or absolute or whatever). In the case of the OP's failures, that processor (or libm, libc, whatever) is giving us less accurate answers than anything else we've tested on, and I think it's worth looking into fixing the problem, or even adding an # optional, or as an expected failure on this platform, rather than weakening the examples and tests for all other platforms. It reminds me a bit of all the correction we had to do because the literal floating point value for e is not correctly compiled on Solaris. It's one thing to have "numerical noise" in a lengthy computation involving lots of floating point arithmetic, it's another to give non-integral values for gamma(n) for small, integral n. - Robert -- 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