Search code examples
fortran

NaN in fortran programming language


i use visual studio 2019 and intel fortran compiler 2021. in Fortran programming language for example when a number divided by zero, i want to stop program and show an error. how to do this?


Solution

  • If you look at the floating point properties for your project you will find the mathematical error handing options available.

    fpe

    Select /fpe:0 to produce exceptions instead of NaN