How to use ieee_arithmetic module in Fortran?

Thanks Charles. Yes, I think f2py works now.

However, there is a separate issue. What should I do if I want to use module ieee_arithmetic? Or should I use something else - what I need is to test if a value is NaN.

Hi Harvey,

Trying to work out precisely what you’re trying to do- do you just want to use ieee_arithmetic in your Fortran module? Or looking for a method to check whether a value is NaN?

Yes, I have ‘use ieee_arithmetic’ in my Fortran code. However, if that is impossible, I’m open to using other method to check whether a value is NaN. Is there a more ‘standard’ way than using ieee_arithmetic?

For more information, the Fortran code is going to be compiled into a Python module using f2py. I think it is related to conda/Python, or more specifically, f2py setup. :slightly_smiling_face:

Do you get an error if you try to use it? In any case, NaNs fail all comparison checks, so it’s the only value that will ever be not equal to itself i.e. (x == x) returns .false. if x is NaN, so that’s a possible way to check. I think the ieee_arithmetic function ieee_is_nan is the officially recommended way though.

When tried to compile my code with ‘f2py -c -m …’ I got:
Fatal Error: Can’t open module file ‘ieee_arithmatic.mod’ for reading at (1): No such file or directory
compilation terminated.

Sorry. I think it has been resolved now - it’s a TYPO (‘ieee_arithmatic’).:sweat_smile:

Fortunately that’s a much easier fix than most problems :slight_smile: I’ll mark this as resolved