ComplexRe

The real part of a complex value.

Declaración

Sintaxis

ComplexRe(expr arg, ttype type, expr? value)

Argumentos

Argument

Descripción

arg

the operand.

type

the type of the expression.

value

the compile time value of the expression, when the frontend could fold it; nil otherwise.

Valores devueltos

The value of the expression.

Descripción

The result is a real of the kind of the operand, so real(z) where z is complex(8) gives a real(8).

Ejemplos

(ComplexRe
  :arg (Var
    :v (SymbolRef 1 "z")
  )
  :type (Real
    :kind 4
  )
  :value nil
)

It comes from this complete ASR text document:

(TranslationUnit
  :symtab (SymbolTable
    :id 0
    :symbols {
      "main" (Program
        :symtab (SymbolTable
          :id 1
          :symbols {
            "b" (Variable
              :parent_symtab 1
              :name "b"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Logical
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
              :common_block nil
            )
            "w" (Variable
              :parent_symtab 1
              :name "w"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Complex
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
              :common_block nil
            )
            "x" (Variable
              :parent_symtab 1
              :name "x"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Real
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
              :common_block nil
            )
            "z" (Variable
              :parent_symtab 1
              :name "z"
              :dependencies []
              :intent :Local
              :symbolic_value nil
              :value nil
              :storage :Default
              :type (Complex
                :kind 4
              )
              :type_declaration nil
              :abi :Source
              :access :Public
              :presence :Required
              :value_attr false
              :target_attr false
              :contiguous_attr false
              :bindc_name nil
              :is_volatile false
              :is_protected false
              :pass_attr :NotMethod
              :self_argument nil
              :codims []
              :common_block nil
            )
          }
        )
        :name "main"
        :dependencies []
        :body [
          (Assignment
            :target (Var
              :v (SymbolRef 1 "z")
            )
            :value (ComplexConstant
              :re 1.0
              :im 2.0
              :type (Complex
                :kind 4
              )
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "z")
            )
            :value (ComplexConstructor
              :re (RealConstant
                :r 1.0
                :type (Real
                  :kind 4
                )
              )
              :im (Var
                :v (SymbolRef 1 "x")
              )
              :type (Complex
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "w")
            )
            :value (ComplexBinOp
              :left (Var
                :v (SymbolRef 1 "z")
              )
              :op :Mul
              :right (ComplexConstant
                :re 0.0
                :im 1.0
                :type (Complex
                  :kind 4
                )
              )
              :type (Complex
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "w")
            )
            :value (ComplexUnaryMinus
              :arg (Var
                :v (SymbolRef 1 "z")
              )
              :type (Complex
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "x")
            )
            :value (ComplexRe
              :arg (Var
                :v (SymbolRef 1 "z")
              )
              :type (Real
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "x")
            )
            :value (ComplexIm
              :arg (Var
                :v (SymbolRef 1 "z")
              )
              :type (Real
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
          (Assignment
            :target (Var
              :v (SymbolRef 1 "b")
            )
            :value (ComplexCompare
              :left (Var
                :v (SymbolRef 1 "z")
              )
              :op :Eq
              :right (Var
                :v (SymbolRef 1 "w")
              )
              :type (Logical
                :kind 4
              )
              :value nil
            )
            :overloaded nil
            :realloc_lhs false
            :move_allocation false
            :new_target false
            :new_allocation false
          )
        ]
        :global_init nil
      )
    }
  )
  :items []
  :global_init nil
)

Ver también

ComplexIm, ComplexConstructor