Question unit testing numerical algorithms
William Park
opengeometry at yahoo.ca
Sun Dec 8 16:05:10 EST 2002
Brian O. Bush <bushbo at attbi.com> wrote:
> All. I have a basic question on testing numerical algorithms. In my
> unit test code, I have two intervals, A = Interval(3.52, 5.83) and B =
> Interval(-2.24, 6.04), and their SUM = Interval(1.28, 11.87). However,
> when run there is a significantly small enough error to allow failure
> in the assertion A+B == SUM.
This is a feature of floating point. :-) If you want accuracy to 2
decimal places, then multiply everything by 100 and use integer.
--
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
Linux solution for data management and processing.
More information about the Python-list
mailing list