clamp Interface

public interface clamp

If v compares less than lo, returns lo; otherwise if hi compares less than v, returns hi; otherwise returns v. Is also defined for lo > hi!


Contents


Module Procedures

private elemental function clamp_integer_int32(v, lo, hi) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int32), intent(in) :: v
integer(kind=int32), intent(in) :: lo
integer(kind=int32), intent(in) :: hi

Return Value integer(kind=int32)

private elemental function clamp_integer_int64(v, lo, hi) result(res)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: v
integer(kind=int64), intent(in) :: lo
integer(kind=int64), intent(in) :: hi

Return Value integer(kind=int64)

private elemental function clamp_real_sp(v, lo, hi) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=sp), intent(in) :: v
real(kind=sp), intent(in) :: lo
real(kind=sp), intent(in) :: hi

Return Value real(kind=sp)

private elemental function clamp_real_dp(v, lo, hi) result(res)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: v
real(kind=dp), intent(in) :: lo
real(kind=dp), intent(in) :: hi

Return Value real(kind=dp)