006. ** is the exponentiation operator#

topic: Basics

The exponentiation operator in Fortran is **, as in Python.

expon.f90 | | Godbolt Compiler Explorer logo | Fortran logo#
print *, 1.2**2  ! 1.44

print *, [1.0, 1.1, 1.2, 1.3]**2

end
Output1#
   1.44000006    
   1.00000000       1.21000004       1.44000006       1.68999982    

Many Fortran operators and intrinsic functions are elemental, and brackets denote arrays.



1

Compiled using GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 with no flags