Axect / puruspe

PURe RUSt SPEcial library
Apache License 2.0
14 stars 6 forks source link

Add a test of `utils::factorial` #19

Closed JSorngard closed 1 month ago

JSorngard commented 1 month ago

This PR adds a test of the factorial function in puruspe, by calculating the factorial naively in a loop and comparing with the output. I use approximate comparisons because there are different floating point errors at very large outputs.

This adds tests for one of the utils functions for #12.

JSorngard commented 1 month ago

It is possible to test to larger input values, but the exponents on the outputs are so large that the small differences in the mantissa due to different floating point errors between the function and the test code result in values that differ enough to need custom epsilon values.

JSorngard commented 1 month ago

I added a big test case manually