Fixed point rendering of a real(sp) value.
Widening to real(dp) is exact for every finite real(sp) value and
preserves NaN and both infinities, so the double precision expansion
produces the same digits.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=sp), | intent(in) | :: | value | |||
| integer(kind=default_int), | intent(in) | :: | decimals |
pure function to_string_fixed_sp(value, decimals) result(string) !! Fixed point rendering of a `real(sp)` value. !! !! Widening to `real(dp)` is exact for every finite `real(sp)` value and !! preserves NaN and both infinities, so the double precision expansion !! produces the same digits. real(sp), intent(in) :: value integer(default_int), intent(in) :: decimals character(len=:), allocatable :: string string = to_string_fixed_dp(real(value, dp), decimals) end function to_string_fixed_sp