TypeInquiry¶
An expr node, which is used to represent the Inquiry
intrinsic function
whose value is computed based on the argument type.
Declaración¶
Sintaxis¶
TypeInquiry(int inquiry_id, ttype arg_type, expr? arg, ttype type, expr value)
Argumentos¶
Argument Name |
Argument Description |
---|---|
|
Function unique ID |
|
argument type |
|
argument passed |
|
output type |
|
compile time value |
Valor devuelto¶
The return value is the expression that the TypeInquiry represents.
Descripción¶
TypeInquiry is used to represent the Inquiry
function. This node accepts
exactly one ttype
as it’s only argument (arg_type
), and it returns a value
depending on inquiry_id
of ttype
type
. Since the type arg_type
is known
at compile time, also the compile time value is always present in value
.
There is an optional argument arg
that specifies the variable used in the
frontend language (used in LFortran, but not present in LPython/NumPy).
Here a list of inquiry_id that we support so far
Inquiry function |
Output |
Output type |
---|---|---|
|
smallest number E |
|
|
largest number |
|
|
decimal precision |
|
|
base of a numeric model |
|
|
decimal exponent range |
|
|
rank of a data object |
|
|
smallest positive number |
|
Note: All the functions output are computed based on the
arg_type
Tipos¶
The arg_type
and type
vary for each inquiry_id signature. The output is
either the default integer or the same as the argument type.
Ejemplos¶
The following example code creates TypeInquiry
ASR node:
print *, tiny(5.0)
ASR:
(Print
[(TypeInquiry
Tiny
(Real 4)
(RealConstant
5.000000
(Real 4)
)
(Real 4)
(RealConstant
0.000000
(Real 4)
)
)]
()
()
)