gpt4 book ai didi

fortran - 涉及整数和实数操作数的算术

转载 作者:行者123 更新时间:2023-12-01 09:55:27 25 4
gpt4 key购买 nike

在 Fortran 中,涉及整数实数操作数的算术总是通过将整数操作数转换为实数来执行和真正的操作数一样吗?还是有什么异常(exception)?

最佳答案

这是在 Ch 中定义的。 Fortran 2008 Standard的7.1.5.1 “内部操作分类” :

注释 7.15 摘录:

Intrinsic operator      Type of     Type of       Type of
op x1 x2 [x1] op x2
----------------------------------------------------------
I I, R, Z I, R, Z
Binary +, –, *, /, ** R I, R, Z R, R, Z
Z I, R, Z Z, Z, Z

[...]

Note: The symbols I, R, Z, C, and L stand for the types integer, real, complex, character, and logical, respectively. Where more than one type for x 2 is given, the type of the result of the operation is given in the same relative position in the next column.

所以是的,在您的情况下它被转换为 real

关于fortran - 涉及整数和实数操作数的算术,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28908369/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com