feed_real_sp64 Subroutine

private pure subroutine feed_real_sp64(state, value)

Canonicalise and feed one real(sp) value.

NaN is tested first, as the one value that is unordered with respect to zero: neither value >= 0 nor value <= 0 holds. That ordered form is used in preference to the more familiar value /= value because it says the same thing without an equality test on a real, which every compiler warns about. Infinities are then separated from finite values by comparison against huge, so that exponent and fraction are only ever applied to a finite, non-zero argument, and zero is finally detected as the value that is not greater than zero in magnitude – which is true for -0.0 as well as +0.0, and is where the two signed zeroes become one.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(inout) :: state
real(kind=sp), intent(in) :: value

Value to encode; may be any value including -0.0, NaN and +/-Inf.


Calls

proc~~feed_real_sp64~~CallsGraph proc~feed_real_sp64 feed_real_sp64 proc~feed_real_record64 feed_real_record64 proc~feed_real_sp64->proc~feed_real_record64 proc~feed_integer64 feed_integer64 proc~feed_real_record64->proc~feed_integer64 proc~fnv1a_byte64 fnv1a_byte64 proc~feed_integer64->proc~fnv1a_byte64 proc~u64_add u64_add proc~fnv1a_byte64->proc~u64_add

Called by

proc~~feed_real_sp64~~CalledByGraph proc~feed_real_sp64 feed_real_sp64 proc~update64_csp_0 array_hash64_t%update64_csp_0 proc~update64_csp_0->proc~feed_real_sp64 proc~update64_csp_1 array_hash64_t%update64_csp_1 proc~update64_csp_1->proc~feed_real_sp64 proc~update64_rsp_0 array_hash64_t%update64_rsp_0 proc~update64_rsp_0->proc~feed_real_sp64 proc~update64_rsp_1 array_hash64_t%update64_rsp_1 proc~update64_rsp_1->proc~feed_real_sp64 none~update~2 array_hash64_t%update none~update~2->proc~update64_csp_0 none~update~2->proc~update64_csp_1 none~update~2->proc~update64_rsp_0 none~update~2->proc~update64_rsp_1 proc~update64_cdp_2 array_hash64_t%update64_cdp_2 none~update~2->proc~update64_cdp_2 proc~update64_cdp_3 array_hash64_t%update64_cdp_3 none~update~2->proc~update64_cdp_3 proc~update64_char_1 array_hash64_t%update64_char_1 none~update~2->proc~update64_char_1 proc~update64_csp_2 array_hash64_t%update64_csp_2 none~update~2->proc~update64_csp_2 proc~update64_csp_3 array_hash64_t%update64_csp_3 none~update~2->proc~update64_csp_3 proc~update64_int16_2 array_hash64_t%update64_int16_2 none~update~2->proc~update64_int16_2 proc~update64_int16_3 array_hash64_t%update64_int16_3 none~update~2->proc~update64_int16_3 proc~update64_int32_2 array_hash64_t%update64_int32_2 none~update~2->proc~update64_int32_2 proc~update64_int32_3 array_hash64_t%update64_int32_3 none~update~2->proc~update64_int32_3 proc~update64_int64_2 array_hash64_t%update64_int64_2 none~update~2->proc~update64_int64_2 proc~update64_int64_3 array_hash64_t%update64_int64_3 none~update~2->proc~update64_int64_3 proc~update64_int8_2 array_hash64_t%update64_int8_2 none~update~2->proc~update64_int8_2 proc~update64_int8_3 array_hash64_t%update64_int8_3 none~update~2->proc~update64_int8_3 proc~update64_logical_2 array_hash64_t%update64_logical_2 none~update~2->proc~update64_logical_2 proc~update64_logical_3 array_hash64_t%update64_logical_3 none~update~2->proc~update64_logical_3 proc~update64_rdp_2 array_hash64_t%update64_rdp_2 none~update~2->proc~update64_rdp_2 proc~update64_rdp_3 array_hash64_t%update64_rdp_3 none~update~2->proc~update64_rdp_3 proc~update64_rsp_2 array_hash64_t%update64_rsp_2 none~update~2->proc~update64_rsp_2 proc~update64_rsp_3 array_hash64_t%update64_rsp_3 none~update~2->proc~update64_rsp_3 proc~hash64_cdp_1 hash64_cdp_1 proc~hash64_cdp_1->none~update~2 proc~hash64_cdp_2 hash64_cdp_2 proc~hash64_cdp_2->none~update~2 proc~hash64_cdp_3 hash64_cdp_3 proc~hash64_cdp_3->none~update~2 proc~hash64_char_0 hash64_char_0 proc~hash64_char_0->none~update~2 proc~hash64_char_1 hash64_char_1 proc~hash64_char_1->none~update~2 proc~hash64_csp_1 hash64_csp_1 proc~hash64_csp_1->none~update~2 proc~hash64_csp_2 hash64_csp_2 proc~hash64_csp_2->none~update~2 proc~hash64_csp_3 hash64_csp_3 proc~hash64_csp_3->none~update~2 proc~hash64_int16_1 hash64_int16_1 proc~hash64_int16_1->none~update~2 proc~hash64_int16_2 hash64_int16_2 proc~hash64_int16_2->none~update~2 proc~hash64_int16_3 hash64_int16_3 proc~hash64_int16_3->none~update~2 proc~hash64_int32_1 hash64_int32_1 proc~hash64_int32_1->none~update~2 proc~hash64_int32_2 hash64_int32_2 proc~hash64_int32_2->none~update~2 proc~hash64_int32_3 hash64_int32_3 proc~hash64_int32_3->none~update~2 proc~hash64_int64_1 hash64_int64_1 proc~hash64_int64_1->none~update~2 proc~hash64_int64_2 hash64_int64_2 proc~hash64_int64_2->none~update~2 proc~hash64_int64_3 hash64_int64_3 proc~hash64_int64_3->none~update~2 proc~hash64_int8_1 hash64_int8_1 proc~hash64_int8_1->none~update~2 proc~hash64_int8_2 hash64_int8_2 proc~hash64_int8_2->none~update~2 proc~hash64_int8_3 hash64_int8_3 proc~hash64_int8_3->none~update~2 proc~hash64_logical_1 hash64_logical_1 proc~hash64_logical_1->none~update~2 proc~hash64_logical_2 hash64_logical_2 proc~hash64_logical_2->none~update~2 proc~hash64_logical_3 hash64_logical_3 proc~hash64_logical_3->none~update~2 proc~hash64_rdp_1 hash64_rdp_1 proc~hash64_rdp_1->none~update~2 proc~hash64_rdp_2 hash64_rdp_2 proc~hash64_rdp_2->none~update~2 proc~hash64_rdp_3 hash64_rdp_3 proc~hash64_rdp_3->none~update~2 proc~hash64_rsp_1 hash64_rsp_1 proc~hash64_rsp_1->none~update~2 proc~hash64_rsp_2 hash64_rsp_2 proc~hash64_rsp_2->none~update~2 proc~hash64_rsp_3 hash64_rsp_3 proc~hash64_rsp_3->none~update~2 proc~soa_hash64_int32_field soa_hash64_int32_field proc~soa_hash64_int32_field->none~update~2 proc~soa_hash64_int64_field soa_hash64_int64_field proc~soa_hash64_int64_field->none~update~2 proc~soa_hash64_logical_field soa_hash64_logical_field proc~soa_hash64_logical_field->none~update~2 proc~soa_hash64_real_dp_field soa_hash64_real_dp_field proc~soa_hash64_real_dp_field->none~update~2 proc~soa_hash64_real_sp_field soa_hash64_real_sp_field proc~soa_hash64_real_sp_field->none~update~2 proc~soa_hash_begin_64 soa_hash_begin_64 proc~soa_hash_begin_64->none~update~2 proc~update64_cdp_2->none~update~2 proc~update64_cdp_3->none~update~2 proc~update64_char_1->none~update~2 proc~update64_csp_2->none~update~2 proc~update64_csp_3->none~update~2 proc~update64_int16_2->none~update~2 proc~update64_int16_3->none~update~2 proc~update64_int32_2->none~update~2 proc~update64_int32_3->none~update~2 proc~update64_int64_2->none~update~2 proc~update64_int64_3->none~update~2 proc~update64_int8_2->none~update~2 proc~update64_int8_3->none~update~2 proc~update64_logical_2->none~update~2 proc~update64_logical_3->none~update~2 proc~update64_rdp_2->none~update~2 proc~update64_rdp_3->none~update~2 proc~update64_rsp_2->none~update~2 proc~update64_rsp_3->none~update~2 interface~array_hash64 array_hash64 interface~array_hash64->proc~hash64_cdp_1 interface~array_hash64->proc~hash64_cdp_2 interface~array_hash64->proc~hash64_cdp_3 interface~array_hash64->proc~hash64_char_0 interface~array_hash64->proc~hash64_char_1 interface~array_hash64->proc~hash64_csp_1 interface~array_hash64->proc~hash64_csp_2 interface~array_hash64->proc~hash64_csp_3 interface~array_hash64->proc~hash64_int16_1 interface~array_hash64->proc~hash64_int16_2 interface~array_hash64->proc~hash64_int16_3 interface~array_hash64->proc~hash64_int32_1 interface~array_hash64->proc~hash64_int32_2 interface~array_hash64->proc~hash64_int32_3 interface~array_hash64->proc~hash64_int64_1 interface~array_hash64->proc~hash64_int64_2 interface~array_hash64->proc~hash64_int64_3 interface~array_hash64->proc~hash64_int8_1 interface~array_hash64->proc~hash64_int8_2 interface~array_hash64->proc~hash64_int8_3 interface~array_hash64->proc~hash64_logical_1 interface~array_hash64->proc~hash64_logical_2 interface~array_hash64->proc~hash64_logical_3 interface~array_hash64->proc~hash64_rdp_1 interface~array_hash64->proc~hash64_rdp_2 interface~array_hash64->proc~hash64_rdp_3 interface~array_hash64->proc~hash64_rsp_1 interface~array_hash64->proc~hash64_rsp_2 interface~array_hash64->proc~hash64_rsp_3 interface~soa_hash_begin soa_hash_begin interface~soa_hash_begin->proc~soa_hash_begin_64 interface~soa_hash_field soa_hash_field interface~soa_hash_field->proc~soa_hash64_int32_field interface~soa_hash_field->proc~soa_hash64_int64_field interface~soa_hash_field->proc~soa_hash64_logical_field interface~soa_hash_field->proc~soa_hash64_real_dp_field interface~soa_hash_field->proc~soa_hash64_real_sp_field proc~particle_soa_state_hash particle_soa_t%particle_soa_state_hash proc~particle_soa_state_hash->interface~soa_hash_begin proc~particle_soa_state_hash->interface~soa_hash_field proc~particle_soa_state_hash64 particle_soa_t%particle_soa_state_hash64 proc~particle_soa_state_hash64->interface~soa_hash_begin proc~particle_soa_state_hash64->interface~soa_hash_field

Variables

Type Visibility Attributes Name Initial
integer(kind=int64), private :: class_code
integer(kind=int64), private :: expo
integer(kind=int64), private :: mantissa
integer(kind=int64), private :: sign_code

Source Code

   pure subroutine feed_real_sp64(state, value)
      !! Canonicalise and feed one `real(sp)` value.
      !!
      !! NaN is tested first, as the one value that is unordered with respect
      !! to zero: neither `value >= 0` nor `value <= 0` holds. That ordered
      !! form is used in preference to the more familiar `value /= value`
      !! because it says the same thing without an equality test on a real,
      !! which every compiler warns about. Infinities are then separated from
      !! finite values by comparison against `huge`, so that `exponent` and
      !! `fraction` are only ever applied to a finite, non-zero argument, and
      !! zero is finally detected as the value that is not greater than zero in
      !! magnitude -- which is true for -0.0 as well as +0.0, and is where the
      !! two signed zeroes become one.
      integer(int64), intent(inout) :: state
      real(sp), intent(in) :: value
         !! Value to encode; may be any value including -0.0, NaN and +/-Inf.

      integer(int64) :: class_code, sign_code, expo, mantissa

      sign_code = 0_int64
      expo = 0_int64
      mantissa = 0_int64
      if (.not. (value >= 0.0_sp .or. value <= 0.0_sp)) then
         class_code = CLASS_NAN
      else if (value > huge(value)) then
         class_code = CLASS_POS_INF
      else if (value < -huge(value)) then
         class_code = CLASS_NEG_INF
      else if (.not. (abs(value) > 0.0_sp)) then
         class_code = CLASS_ZERO
      else
         class_code = CLASS_FINITE
         if (value < 0.0_sp) sign_code = 1_int64
         expo = int(exponent(value), int64)
         mantissa = int(scale(fraction(abs(value)), digits(value)), int64)
      end if
      call feed_real_record64(state, class_code, sign_code, expo, mantissa)
   end subroutine feed_real_sp64