ieee_arithmetic intrinsic module in gfortran

2020-04-02 08:19发布

I need to use gfortran to compile a library that is dependent on ieee_arithmetic. However, it is found that gfortran can not identify this module.

For example with the code a.f90

program test
   use,intrinsic :: ieee_arithmetic
   real :: x
   read *, x
   if (ieee_is_nan(x)) then
      print *, "Nan"
   else
   print *, "Not NaN"
end if
end program test

I have the following message when compiling

$ gfortran a.f90
a.f90:2.19:

use,intrinsic :: ieee_arithmetic
               1
Fatal Error: Can't find an intrinsic module named 'ieee_arithmetic' at (1)

How can I let gfortran know where the ieee_arithmetic intrinsic module is?

ifort is found to be able to use the ieee_arithmetic module. But I wish to make gfortran work for this case.

1条回答
贼婆χ
2楼-- · 2020-04-02 08:53

The IEEE modules are supported as of GFortran version 5. See https://gcc.gnu.org/gcc-5/changes.html If you are using an older version, you should see the error message you have shown in your post.

查看更多
登录 后发表回答