006. **
is the exponentiation operator#
topic: Basics
The exponentiation operator in Fortran is **
, as in Python.
print *, 1.2**2 ! 1.44
print *, [1.0, 1.1, 1.2, 1.3]**2
end
1.44000006
1.00000000 1.21000004 1.44000006 1.68999982
Many Fortran operators and intrinsic functions are elemental, and brackets denote arrays.
The exponentiation operator in Fortran is **, as in Python.
— FortranTip (@fortrantip) December 17, 2021
print*,1.2**2
gives 1.44
Many Fortran operators and intrinsic functions are elemental, and brackets denote arrays, so
print*,[1.0,1.1,1.2,1.3]**2
gives
1.00000000 1.21000004 1.44000006 1.68999982
- 1
Compiled using
GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
with no flags