sagetolerance * DBL_EPSILON <= abs(f(x)-expected_result) would be one general method to test for epsilon equivalency at double precision.
On Mar 17, 7:06 am, Jason Grout <jason-s...@creativetrax.com> wrote: > On3/17/11 12:35 AM, Robert Bradshaw wrote: > > > > > > > On Wed, Mar 16, 2011 at 6:15 PM, Jason Grout > > <jason-s...@creativetrax.com> wrote: > >> On 3/16/11 3:04 PM, Peter Jeremy wrote: > > >>> Overall, I believe the abs(actual-expected)<tiny_number approach is > >>> the only practical way to handle doctests. The expected numeric > >>> result is still available, just not on a line by itself. > > >> Crazy idea: What if we introduce a "# numeric 1e-10" doctest flag (like > >> #optional, etc.) that does just that---reads in the doctest answer, gets > >> the > >> output of the function, and does an abs(actual-expected)< epsilon (where > >> epsilon can be specified in the flag, or it has a default). > > >> sage: some_numerical_function() # numeric 1e-6 > >>3.43234454 > > >> passes if abs(real result-3.43234454)<1e-6 > > > +1, that's a great idea. I'd be up for # [relative|absolute] tolerance > > [<epsilon>] > > In case people missed it, Robert put his code where his mouth and vote > was:http://trac.sagemath.org/sage_trac/ticket/10952 > > So now it needs review. I've put up a comment or two. It would be > great if multiple people looked at it, though. > > Jason -- 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