Converts a logical into a real.
0 equals to false, everything else equals to true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
logical, | intent(in) | :: | value |
The value to interpret as boolean |
The value interpreted as boolean
function logicalToReal(value) result(res) ! ------------------------------------------------------------------------ ! !> The value to interpret as boolean logical, intent(in) :: value !> The value interpreted as boolean real(kind=rk) :: res ! ------------------------------------------------------------------------ ! if (value) then res = numTrue else res = numFalse end if end function logicalToReal