On Aug 5, 6:44 pm, David Kirkby <david.kir...@onetel.net> wrote:
> 2010/8/5 Sergey Bochkanov <sergey.bochka...@alglib.net>:
> > Hello, Jason.
>
> > You wrote 5 августа 2010 г., 20:17:11:
> >>> (depending  on  problem and its stability properties). However I don't
> >>> know  how  to  do  it  using doctest framework. Python tries to output
> >>> numbers  with  full  precision,and  there  is no way to tell doctest
> >>> framework to compare decimal fractions using only N leading digits.
>
> >> Yes, there is.  The doctest below will compare only the digits listed:
> >> sage: maxima('asinh(1.0)')
> >> 0.88137...
>
> > Thanks!  I didn't noticed this ELLIPSIS option while reading doctest's
> > documentation. Everything becomes a bit simpler now :)
>
> > --
> > With best regards,
> >  Sergey                          mailto:sergey.bochka...@alglib.net
>
> Yes, that's what I mean by trivial. But the missing leading zero is
> less trivial.
>
> With all the numerical noise issues I've seen in Sage, the three dots
> solves its. So if we expect
>
> 1.00000000000000
> but get
> 1.00000000000001
> we can change that to
> 1.0000000000000...
> and the test will pass.
>
> However, what if we get
>
> 0.99999999999999
>
> That's very close to 1, but not a single digit is the same. I'm not
> sure how one would handle that case.

well, one needs to call a function to do a proper rounding before
doing the comparison in this case
(alternatively, one might add certain \epssilon>0 to shift the thing
above 1.0)

Dima

>
> Dave

-- 
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

Reply via email to