[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proposal: assert_double_close and assert_double_allclose


Hi,

This is a proposal for two new functions; original post is on github:

https://github.com/clibs/cmocka/issues/10

moving discussion to the ML.

For numerical applications we sometimes need to test if floating point
numbers are correct.

two useful functions are

int assert_double_close(double a, double b, double rtol, double atol);

int assert_double_allclose(double *a, double * b, int size, double
rtol, double atol);

The behaviour of these functions can be modelled after the testing
functions in numpy:

https://docs.scipy.org/doc/numpy-dev/reference/generated/numpy.testing.
assert_allclose.html

I'd like to start working on a PR, if there are no other considerations
that these functions were not included in cmocka.


Thanks,

- Yu