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

Why we need a double precision functions?

if001
Beginner
2,766 Views
For example, there is a same result

REAL(8) :: log_double = 5.D0
PRINT*,"LOG ( DOUBLE ) =", LOG(log_double)
PRINT*,"DLOG( DOUBLE ) =", DLOG(log_double)



LOG ( DOUBLE ) = 1.60943791243410
DLOG( DOUBLE ) = 1.60943791243410
Thanks for answers,

Pete.
0 Kudos
6 Replies
mecej4
Honored Contributor III
2,766 Views
In Fortran 77 and earlier, there was ALOG for single precision arguments and DLOG for double precision arguments. Fortran 90 introduced the generic function LOG to make it easier to write code without having to remember the specific names of all the intrinsic functions. LOG() is equivalent to ALOG and LOG() is equivalent to DLOG.

The specific names are still retained for the sake of backwards compatibility.
0 Kudos
if001
Beginner
2,766 Views
Thank you. I hope that a same way was made for SIN, COS and etc.....
0 Kudos
TimP
Honored Contributor III
2,766 Views
All of the intrinsic functions mentioned in this thread were made generic in the f77 standard, making the f66 double precision versions de facto obsolescent. Internally, the support library may have separate entry points for various data types (not to mention scalar vs. vector, and for various instruction sets and, in ifort 12, arch-compatibility vs. specific sub-architectures), all accessed via the standard intrinsic names.
0 Kudos
if001
Beginner
2,766 Views
Oh, the last stuppid question please!
About entry points.
Will be my prog run "faster" if old fashion DSIN(double) vs SIN(double)is using?
0 Kudos
Steven_L_Intel1
Employee
2,766 Views
No. Exactly the same run-time code is used in either case. However, use of specific functions such as DSIN can cause maintenance problems later so I recommend using the generic functions where possible.
0 Kudos
if001
Beginner
2,766 Views
Thank you Steve,

This is sad news for all my previuos program code. :)
DEC is in our hearts. ;)

0 Kudos
Reply