Skip to content

Commit

Permalink
Fix error thrown in case of tolerance too low (#44)
Browse files Browse the repository at this point in the history
* Fix error thrown in case of tolerance too low

Fixes #43

* Update test_error_handler.jl

Make sure too lower tolerance doesn't throw an error

Co-authored-by: Ludvig af Klinteberg <[email protected]>
  • Loading branch information
jkrimmer and ludvigak authored Sep 1, 2022
1 parent cd95552 commit 162014a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/FINUFFT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ function check_ret(ret)
return
elseif ret==ERR_EPS_TOO_SMALL
msg = "requested tolerance epsilon too small to achieve (warning only)"
@warn msg
return
elseif ret==ERR_MAXNALLOC
msg = "attemped to allocate internal array larger than MAX_NF (defined in defs.h)"
elseif ret==ERR_SPREAD_BOX_SMALL
Expand Down
8 changes: 2 additions & 6 deletions test/test_error_handler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ using Test

@info("Testing error handling")

# Tolerance too small
try
nufft1d1(xj, cj, iflag, 1e-100, ms)
catch e
@test e.errno == FINUFFT.ERR_EPS_TOO_SMALL
end
# Tolerance too small (should only warn)
nufft1d1(xj, cj, iflag, 1e-100, ms)

# Allocate too much
opts = finufft_default_opts()
Expand Down

0 comments on commit 162014a

Please sign in to comment.