real_to_string Subroutine

private subroutine real_to_string(rval, str)

Arguments

Type IntentOptional AttributesName
real(kind=RK), intent(in) :: rval

real value.

character(kind=CK,len=*), intent(out) :: str

rval converted to a string.

Description

Convert a real value to a string.

Modified

  • Izaak Beekman : 02/24/2015 : added the compact option.
  • Jacob Williams : 10/27/2015 : added the star option.

Calls

proc~~real_to_string~~CallsGraph proc~real_to_string real_to_string proc~compact_real_string compact_real_string proc~real_to_string->proc~compact_real_string
Help

Called By

proc~~real_to_string~~CalledByGraph proc~real_to_string real_to_string proc~json_value_print json_value_print proc~json_value_print->proc~real_to_string proc~json_value_print->proc~json_value_print proc~json_value_to_string json_value_to_string proc~json_value_to_string->proc~json_value_print proc~json_file_print_1 json_file_print_1 proc~json_file_print_1->proc~json_value_print proc~json_print_1 json_print_1 proc~json_print_1->proc~json_value_print proc~json_file_print_to_console json_file_print_to_console proc~json_file_print_to_console->proc~json_value_print proc~json_file_print_to_string json_file_print_to_string proc~json_file_print_to_string->proc~json_value_to_string interface~json_print_to_string json_print_to_string interface~json_print_to_string->proc~json_value_to_string proc~test_4 test_4 proc~test_4->interface~json_print_to_string interface~json_print json_print proc~test_4->interface~json_print program~jf_test_4 jf_test_4 program~jf_test_4->proc~test_4 interface~json_print->proc~json_print_1 proc~json_print_2 json_print_2 interface~json_print->proc~json_print_2 proc~test_7 test_7 proc~test_7->interface~json_print proc~test_2 test_2 proc~test_2->interface~json_print proc~test_12 test_12 proc~test_12->interface~json_print proc~test_8 test_8 proc~test_8->interface~json_print proc~test_14 test_14 proc~test_14->interface~json_print proc~json_print_2->interface~json_print program~jf_test_7 jf_test_7 program~jf_test_7->proc~test_7 program~jf_test_2 jf_test_2 program~jf_test_2->proc~test_2 program~jf_test_12 jf_test_12 program~jf_test_12->proc~test_12 program~jf_test_8 jf_test_8 program~jf_test_8->proc~test_8 program~jf_test_14 jf_test_14 program~jf_test_14->proc~test_14
Help

Variables

TypeVisibility AttributesNameInitial
integer(kind=IK), public :: istat

Source Code

    subroutine real_to_string(rval,str)

    implicit none

    real(RK),intent(in)                  :: rval  !! real value.
    character(kind=CK,len=*),intent(out) :: str   !! rval converted to a string.

    integer(IK) :: istat

    if (real_fmt==star) then
        write(str,fmt=*,iostat=istat) rval
    else
        write(str,fmt=real_fmt,iostat=istat) rval
    end if

    if (istat==0) then

        !in this case, the default string will be compacted,
        ! so that the same value is displayed with fewer characters.
        if (compact_real) call compact_real_string(str)

    else
        str = repeat(star,len(str))
    end if

    end subroutine real_to_string