On Mar 17, 1:50 am, kcrisman <kcris...@gmail.com> wrote: > On Mar 16, 9: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 > > Nothin' crazy 'bout that. But it would be a lot of work to educate > people about it, get consistency, replace previous doctests... well, > not a LOT of work, but work. What do you think, is it worth it? It > would definitely help a lot with always adjusting numerical accuracy > things where the *exact* answer is not important (as opposed to, say, > RealField(10000)). > I have already suggested it before in this thread but testing n(somefunction,sigfig) would achieve the same thing without adding anything. And you don't need to add it when you want an "exact" answer.
Francois -- 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