Sorry for the resend, but I failed to credit Steve Neuendorffer with his comments: --------
jpat <[EMAIL PROTECTED]> writes: > Yes, I must say I was quite surprised to find an error of this > obviousness in a package as mature as Ptolemy. Given the > catestrophic effects on the operation of any fixed-point simulation, > it is also surprising that that no one had complained up until now. Yep, it bites when there are bugs like 2+2=5. We have a pretty good regression test system, but it does require that developers write tests. I've found that in an academic setting, if unit tests are not written during development, then they usually do not get written at all. Part of writing tests is looking over code coverage, which we also do. I think a big part of the problem is that writing good tests for basic building blocks like math packages is rather dry, and it is hard to get excited about doing. However, the building blocks are fairly critical to the operation of Ptolemy. Testing a math package by using it in a model does not really cut it, the corner cases really need to be explicitly tested. [Steve writes:] > It looks like there are other problems with the fixpoint package, > however. I bit of quick poking seems to suggest that > truncate(fixpoint) and round(fixpoint) both truncate the value. There ar e > probably other bugs as well. > Particularly disturbing is that there were tests for the truncate method > that were obviously wrong (and not even returning one of the closest > fixed-point values...) Of course, all the tests in the world make little difference if they are testing the wrong results > There are quite a few test suites for IEEE754/854... perhaps we could gr ab > one and leverage it? I don't know if it would have caught this error or > not, but... Unfortunately, the FixPoint code is a bit orphaned at the > moment... If someone wants to take this task on, then that would be helpful. The test suite is documented in $PTII/doc/coding/testing.htm which can be found on line at http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII1.0/ptII1.0/doc/coding/tes ting.htm Basically, someone would need to go through ptolemy/math/test/FixPoint.tcl and update the tests. The tests are written using tcl, but they are fairly easy to understand. The Ptolemy group software practices are documented in a paper: J. Reekie, S. Neuendorffer, C. Hylands and E. A. Lee "Software Practice in the Ptolemy Project," Technical Report Series, GSRC-TR-1999-01, Gigascale Semiconductor Research Center, University of California, Berkeley, CA 94720, April 1999. which can be found at http://www.gigascale.org/pubs/1.html -Christopher Christopher Hylands [EMAIL PROTECTED] University of California Ptolemy/Gigascale Silicon Research Center US Mail: 558 Cory Hall #1770 ph: (510)643-9841 fax:(510)642-2739 Berkeley, CA 94720-1770 home: (510)526-4010 (Office: 400A Cory) --------------------------------------------------------------------------- - Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED] -------- ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]