[gambit-list] Proposed patch

Marc Feeley feeley at iro.umontreal.ca
Wed Dec 11 11:39:11 EST 2013

On Dec 11, 2013, at 10:02 AM, Bradley Lucier <lucier at math.purdue.edu> wrote:

> On 12/10/2013 10:27 PM, Marc Feeley wrote:
>> For example cos and cosh have a single test for the special value 0, whereas there are 8 tests for asin.
> Counting number of tests is not a very perspicacious analysis technique.
>                                             asin     acos cos/cosh
> number of branch cuts                          2       2      0
> tests per branch cut                           3       3
> Number of special values                       1       1        1
> Does naive implementation suffer               yes     no       no
> from catastrophic cancellation?
> Total number of tests                           8       7       1
>>  That is not very thorough testing.
> That comment doesn't deserve comment.

I'm sorry if my comment came across badly.  I didn't mean any disrespect.

You previously said that unit testing was new to you, so I'm trying to explain what would be better unit testing.  When the only checks are (cos 0) = 1 and (cosh 0) = 1, not much is being verifying about their behavior.  In fact, the implementor of those functions may have mistakenly switched their semantics (i.e. cos is really bound to the cosh function, and cosh is really bound to the cos function) and the unit tests would still have passed.  Some properties of those functions should be checked also, such as -1 <= (cos x) <= 1 and (cosh x) >= 1 and (cos x) = (cos -x), and exactness propagation (cos[h] 0.0) = 1.0, and also specific normal (non special-case) values.  Finally, the behavior of those functions also includes the exceptions they raise, so some tests are needed to make sure they work for all numbers including complex, but raise exceptions for other data types.


More information about the Gambit-list mailing list