stdlib icon indicating copy to clipboard operation
stdlib copied to clipboard

Fixes for extended and quad precision checking. Add CI cheks with fpm

Open jalvesz opened this issue 1 year ago • 2 comments

After looking at #819 I realized that there were several issues:

  1. in the _specialfunctions_gamma files, there were this kind of fypp macros:
#:set WITH_QP = False
#:set WITH_XDP = False
#:include "common.fypp"

Which implied that the different kind definitions were being redefined. In parallel, this means that some files were correctly preprocessed and others not, depending on when the problematic files were being preprocessed. 2. many tests are not using fypp "properly" so I refactored those that I catched after the modifications 3. Seems like there is no CI checking xdp, so I propose to use the fpm CI to check xdp and qp with gfortran. 4. I don't know if test-drive is not built with xdp and qp, but the call check( ... ) using the tolerance argument thr had to be modified to avoid passing xdp or qp arguments.

I think this is ready for consideration @perazz @jvdp1 @nsh-envs

jalvesz avatar May 18 '24 07:05 jalvesz

I agree with @jvdp1: great work @jalvesz, thank you for finding this out! I don't want to have you rewrite your PR but here is some thought. Elsewhere because LAPACK also does not support xdp, I've used this approach:

https://github.com/fortran-lang/stdlib/blob/42182b080d232fb0704ae1578a9235fe3cf57ef7/src/stdlib_linalg_determinant.fypp#L17-L18

So here, it could be something like this?

#:if rk not in ["xdp","qp"]

Also: the special functions just want to be for the "core" types (32- and 64-bit). So I'm not suggesting to do it in this PR, but would there be a way we could unify this once and forall? For example, by having some CORE_REAL_KINDS defined in common.fypp as opposed to all REAL_KINDS?

https://github.com/fortran-lang/stdlib/blob/42182b080d232fb0704ae1578a9235fe3cf57ef7/include/common.fypp#L21-L28

perazz avatar May 18 '24 12:05 perazz

For test-drive to accept extended double and quadruple precision the C preprocessor macros WITH_XDP=1 and WITH_QP=1 need to be set when compiling test-drive.

awvwgk avatar May 19 '24 06:05 awvwgk

@jalvesz It sounds it is ready to be merged. We will wait a few more days, and then merge it. Thank you.

jvdp1 avatar Jun 11 '24 13:06 jvdp1

Thank you @jalvesz . I will merge it now.

jvdp1 avatar Jun 13 '24 19:06 jvdp1