I have noticed using gfortran that the tan
function returns real values of the same kind as its argument; e.g. one can pass real(kind=4)
, real(kind=8)
or real(kind=16)
to it and get results in real(kind=4)
, real(kind=8)
or real(kind=16)
respectively.
Double precision functions like dtan
, on the other hand, are not as flexible. If the default double kind is 8[1] they only accept and return real(kind=8)
and if the default kind is 16[2], they only accept and return real(kind=16)
.
Are these defined behaviors and if so, what is the use case for the double precision functions or are they obsolete?
[1] if compiled with -fdefault-double-8
or without -fdefault-real-8
[2] if compiled with -fdefault-real-8
and without -fdefault-double-8