8.4.7 InInterval Procedure

The InInterval procedure provides a way to check whether or not a value lies within a specified interval. The interval is considered to be a closed interval that includes the end-points. For an array-valued X, all the values must satisfy the condition for the result to be true.

Note that I would rather call this routine ``In_Interval'', but the F90 standard does not allow underscores in defined operator names (i.e. ``.In_Interval.'' is not allowed).

Calling syntax:

Logical = X .InInterval. (/Int1, Int2/) |
, |

Logical = X .InInterval. Interval |
or |

Logical = InInterval(X, Interval) |

Input variables:

X |
Input integer or real, scalar or array variable. | ||

Interval |
A vector of length 2 that specifies the extents of the interval to be checked. | ||

(/Int1, Int2/) |
A means of expressing an interval without declaring a vector. |

Output variable:

InInterval |
Logical which is true if X is in the closed interval, which includes the end-points. |

The InInterval code listing contains additional documentation.

Michael L. Hall