efp_to_real Function

public pure function efp_to_real(a) result(r)

efp_t -> real64. Regularises a LOCAL COPY of a (never mutates the argument) – pure with intent(in), per FORTRAN_STYLE.md’s “default new procedures to pure” (MOM6’s EFP_to_real instead mutates its intent(inout) argument).

a%poison /= 0 short-circuits to a quiet NaN – see efp_t’s docstring for why: this is what turns a non-finite input anywhere in the accumulation into a NaN OUTPUT, instead of the fixed-point bins (zeroed by a NaN decompose, or saturated by an overflow one) silently reconstructing a plausible finite value.

Arguments

Type IntentOptional Attributes Name
type(efp_t), intent(in) :: a

Return Value real(kind=real64)


Calls

proc~~efp_to_real~~CallsGraph proc~efp_to_real efp_to_real proc~efp_regularize efp_regularize proc~efp_to_real->proc~efp_regularize proc~efp_carry efp_carry proc~efp_regularize->proc~efp_carry

Called by

proc~~efp_to_real~~CalledByGraph proc~efp_to_real efp_to_real proc~efp_real_diff efp_real_diff proc~efp_real_diff->proc~efp_to_real proc~ocean_console_stats_report ocean_console_stats_report proc~ocean_console_stats_report->proc~efp_to_real proc~console_stats_report console_stats_report proc~ocean_console_stats_report->proc~console_stats_report proc~console_stats_report->proc~efp_real_diff proc~driver_run_ocean driver_run_ocean proc~driver_run_ocean->proc~ocean_console_stats_report proc~driver_run driver_run proc~driver_run->proc~driver_run_ocean

Variables

Type Visibility Attributes Name Initial
integer(kind=int64), private :: e(EFP_DIGITS)

Source Code

   pure function efp_to_real(a) result(r)
      !! `efp_t -> real64`.  Regularises a LOCAL COPY of `a` (never mutates
      !! the argument) -- `pure` with `intent(in)`, per
      !! `FORTRAN_STYLE.md`'s "default new procedures to pure" (MOM6's
      !! `EFP_to_real` instead mutates its `intent(inout)` argument).
      !!
      !! `a%poison /= 0` short-circuits to a quiet NaN -- see `efp_t`'s
      !! docstring for why: this is what turns a non-finite input anywhere
      !! in the accumulation into a NaN OUTPUT, instead of the fixed-point
      !! bins (zeroed by a NaN decompose, or saturated by an overflow one)
      !! silently reconstructing a plausible finite value.
      type(efp_t), intent(in) :: a
      real(real64) :: r
      integer(int64) :: e(EFP_DIGITS)
      if (a%poison /= 0_int64) then
         r = ieee_value(r, ieee_quiet_nan)
         return
      end if
      e = a%v
      call efp_regularize(e)
      r = real(e(1), real64)*EFP_PR1 + real(e(2), real64)*EFP_PR2 &
          + real(e(3), real64)*EFP_PR3 + real(e(4), real64)*EFP_PR4 &
          + real(e(5), real64)*EFP_PR5 + real(e(6), real64)*EFP_PR6
   end function efp_to_real