Jeroen Demeyer wrote: > On 2016-08-12 11:24, leif wrote: >> Yeah, the doctest framework should automatically base the tolerance on >> such comparisons... ;-) :P > > I don't know how serious you use, but you have to keep in mind that the > doctest framework works with strings. The main problem is that you would > need to guess the precision in bits from some string representation. > That's not easy because RealField and RDF already print numbers > differently.
Not /that/ serious, as the mark-up was supposed to indicate. ;-) While this may be trivial for toy examples, it'll get hard to impossible for more complex ones, as you'd have to interpret the code doing the computations and derive formulas from that, where you must not simplify expressions in the first place to take into account precision of each individual operation performed. (Also, thresholds and cut-offs in algorithms are usually "hard-coded" rather than given by explicit formulas one could interpret, i.e., these are in comments or hidden in [hopefully] referenced papers.) You'd also need specifications for externally defined functions. But rather than trying that at test time, a tool could help /when writing the tests/ (such that you could use the value(s) and tolerance you get from that in the "expected" results), for "easy" cases at least. In practice, most people just take *their* result (i.e., copy-paste what they get on their machine, and probably add some guessed tolerance, perhaps after some buildbot complained). I think we had some discussion that in /examples/ the latter is more appropriate than giving some "fake" (more) exact result. > Apart from this issue, we could support something like "# ulp tol 2" for > a tolerance of 2 ulp. At least we should fix #21121 [1], which is distantly related. -leif [1] "Precision in doctest tolerance: x > x" https://trac.sagemath.org/ticket/21121 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.