Skip to content

Python vs. Fortran integer division

Fortran integer division results in the truncated output of the operands. However, since Python3, Python automatically casts the result of the division between two integers to float.

This difference can be addressed in the Python code by casting the result in Python of each division like so: int(a/b) or use the integer division operator: a//b. An example of this approach is shown in def_parallel_decomposition.py file.

Edited by rmarti1