Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

question on precision

coolweather
Beginner
632 Views
my variables are declared as
integer, parameter :: varsize = 8
real(varsize), allocatable :: myarray (:,:,:)
and I need to compute using some trigonometric functions with as maximum precision as possible
shoud I use dcos, dsin, dacos,... functions insteed of sin, cos.... ?
what will be the difference in precision (significant numbers after point) in the both cases ?
thank you !
0 Kudos
1 Reply
TimP
Honored Contributor III
632 Views
The generic intrinsics (since 30 years ago) such as sin, cos automatically adjust to the kind of the argument, so
sin(myarray)
will give you the identical library function as the style prior to 30 years ago
dsin(myarray)
except that the latter probably breaks when varsize changes. The specific kind number 8 of course works for Intel compilers but not all other brands. This gives you about 16 significant decimal precision (see spacing(x), since 20 years ago), counting before and after decimal point.
ifort, and several other compilers, also have quad precision math libraries which come in for varsize=selected_real_kind(30), at a cost in performance.
0 Kudos
Reply