Re: numpy.allclose()

2015-01-18 Thread Steven D'Aprano
Ian Kelly wrote: > On Sat, Jan 17, 2015 at 8:09 PM, Steven D'Aprano > wrote: >> I'm guessing that can only have come from the mindset of C/C++ >> programmers, where this sort of thing is considered acceptable: > > Maybe. The journal reference in the second link I posted dates the > practice back

Re: numpy.allclose()

2015-01-18 Thread Ian Kelly
On Sat, Jan 17, 2015 at 8:09 PM, Steven D'Aprano wrote: > I'm guessing that can only have come from the mindset of C/C++ programmers, > where this sort of thing is considered acceptable: Maybe. The journal reference in the second link I posted dates the practice back to at least 1975, a time pred

Re: numpy.allclose()

2015-01-17 Thread Steven D'Aprano
Ian Kelly wrote: > On Sat, Jan 17, 2015 at 7:26 AM, Steven D'Aprano > wrote: >> I don't understand why they add the error tolerances together. I can >> understand taking the minimum, or the maximum: > > The usual idea is that the tolerance is calculated as a relative > value, but an absolute tol

Re: numpy.allclose()

2015-01-17 Thread Ian Kelly
On Sat, Jan 17, 2015 at 7:26 AM, Steven D'Aprano wrote: > I don't understand why they add the error tolerances together. I can > understand taking the minimum, or the maximum: The usual idea is that the tolerance is calculated as a relative value, but an absolute tolerance is used instead when th

numpy.allclose()

2015-01-17 Thread Steven D'Aprano
quot;close" if you give two tolerances even though it fails each test individually: py> numpy.allclose([1.2], [1.0], 0.0, 0.1) # Fails absolute error test. False py> numpy.allclose([1.2], [1.0], 0.1, 0.0) # Fails relative error test. False py> numpy.allclose([1.2], [