to_real_sp Subroutine

private pure elemental subroutine to_real_sp(str, val, status_ok)

Convert a string to a real(sp)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
real(kind=sp), intent(out) :: val
logical, intent(out) :: status_ok

Called by

proc~~to_real_sp~~CalledByGraph proc~to_real_sp to_real_sp proc~csv_get_value csv_file%csv_get_value proc~csv_get_value->proc~to_real_sp proc~get_column csv_file%get_column proc~get_column->proc~csv_get_value proc~get_character_column csv_file%get_character_column proc~get_character_column->proc~get_column proc~get_csv_string_column csv_file%get_csv_string_column proc~get_csv_string_column->proc~get_column proc~get_integer_column csv_file%get_integer_column proc~get_integer_column->proc~get_column proc~get_logical_column csv_file%get_logical_column proc~get_logical_column->proc~get_column proc~get_real_sp_column csv_file%get_real_sp_column proc~get_real_sp_column->proc~get_column proc~get_real_wp_column csv_file%get_real_wp_column proc~get_real_wp_column->proc~get_column

Source Code

    pure elemental subroutine to_real_sp(str,val,status_ok)

    implicit none

    character(len=*),intent(in) :: str
    real(sp),intent(out) :: val
    logical,intent(out) :: status_ok

    integer :: istat  !! read `iostat` error code

    read(str,fmt=*,iostat=istat) val
    if (istat==0) then
        status_ok = .true.
    else
        status_ok = .false.
        val = zero
    end if

    end subroutine to_real_sp