Skip to content

fix build failure with nagfor because of "isnan" (issue #159) #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/tests/stats/test_mean.f90
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ program test_mean
use stdlib_experimental_kinds, only: sp, dp, int32, int64
use stdlib_experimental_io, only: loadtxt
use stdlib_experimental_stats, only: mean
use,intrinsic :: ieee_arithmetic, only : ieee_is_nan
implicit none

real(sp), parameter :: sptol = 1000 * epsilon(1._sp)
Expand Down Expand Up @@ -60,9 +61,9 @@ program test_mean

! check mask = .false.

call assert( isnan(mean(d, .false.)))
call assert( any(isnan(mean(d, 1, .false.))))
call assert( any(isnan(mean(d, 2, .false.))))
call assert( ieee_is_nan(mean(d, .false.)))
call assert( any(ieee_is_nan(mean(d, 1, .false.))))
call assert( any(ieee_is_nan(mean(d, 2, .false.))))

! check mask of the same shape as input
call assert( abs(mean(d, d > 0) - sum(d, d > 0)/real(count(d > 0), dp)) < dptol)
Expand Down Expand Up @@ -125,18 +126,18 @@ program test_mean

! check mask = .false.

call assert( isnan(mean(d4, .false.)))
call assert( any(isnan(mean(d4, 1, .false.))))
call assert( any(isnan(mean(d4, 2, .false.))))
call assert( any(isnan(mean(d4, 3, .false.))))
call assert( any(isnan(mean(d4, 4, .false.))))
call assert( ieee_is_nan(mean(d4, .false.)))
call assert( any(ieee_is_nan(mean(d4, 1, .false.))))
call assert( any(ieee_is_nan(mean(d4, 2, .false.))))
call assert( any(ieee_is_nan(mean(d4, 3, .false.))))
call assert( any(ieee_is_nan(mean(d4, 4, .false.))))


! check mask of the same shape as input
call assert( abs(mean(d4, d4 > 0) - sum(d4, d4 > 0)/real(count(d4 > 0), dp)) < dptol)
call assert( any(isnan(mean(d4, 1, d4 > 0))) )
call assert( any(isnan(mean(d4, 2, d4 > 0))) )
call assert( any(isnan(mean(d4, 3, d4 > 0))) )
call assert( any(ieee_is_nan(mean(d4, 1, d4 > 0))) )
call assert( any(ieee_is_nan(mean(d4, 2, d4 > 0))) )
call assert( any(ieee_is_nan(mean(d4, 3, d4 > 0))) )
call assert( sum(abs(mean(d4, 4, d4 > 0) - sum(d4, 4, d4 > 0)/real(count(d4 > 0, 4), dp))) < dptol)

end program
Loading