bound(3f) - [M_math] constrain a value to a range
Synopsis
Description
Example
elemental function bound(bottom, middle, top)
TYPE, intent(in) :: bottom, middle, top TYPE :: boundwhere TYPE may be REAL or INTEGER of default kind
Constrain a value to the range from BOTTOM to TOP. The user is responsible for ensuring BOTTOM is less than or equal to TOP.
Sample program
Linux Linux program demo_bound use M_math, only : bound implicit none write(*, *)bound(1, 3, 10) write(*, *)bound(1, -30, 10) write(*, *)bound(1, 30, 10) write(*, *)bound(-11.11, 5.5, 9.999) end program demo_bound
Example output
3 1 10 5.50000000
bound (3) | March 11, 2021 |