What is the purpose of the Fortran 77 commands expg and dexp?

  • Context: Fortran 
  • Thread starter Thread starter Triscas
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary

Discussion Overview

The discussion revolves around the Fortran 77 commands "expg" and "dexp," specifically their meanings and usage in a given code context. Participants explore the nature of these commands, with a focus on whether "expg" is a standard function or a user-defined one, and how to identify its definition within a program.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant presents an expression using "dexp" and speculates that it calculates the exponential value with double precision.
  • Another participant confirms the use of "dexp" and questions the meaning of "expg," suggesting it may not be part of the Fortran standard.
  • There is a suggestion that "expg" could be a user-defined function or part of a specific manufacturer's version of Fortran.
  • Participants discuss methods to determine the meaning of "expg," including checking for its declaration in the code or identifying the original computer system used for the program.
  • One participant reveals that "expg" is indeed a user-defined function, providing its definition and explaining its purpose to prevent underflow for small values.
  • There is acknowledgment of the possibility that "expg" could be defined in a library linked during compilation, highlighting the historical context of Fortran extensions by various manufacturers.

Areas of Agreement / Disagreement

Participants generally agree that "dexp" is a standard function for calculating exponentials, while there is no consensus on the status of "expg" until its user-defined nature is confirmed. The discussion reflects both uncertainty and exploration of the topic.

Contextual Notes

Participants mention the potential for "expg" to be defined outside the main program, possibly in linked libraries, and the historical context of Fortran extensions, which may affect understanding.

Who May Find This Useful

Readers interested in Fortran programming, particularly those dealing with legacy code or user-defined functions, may find this discussion relevant.

Triscas
Messages
9
Reaction score
0
Hi!

I have the next expression and I don't know what exactly mean the commands

a= dexp ((const1)* (b-298) / (b*298))

This one, I guess it's to calculate the exponential value of the expression giving a double precission.

But i didn't find any info about the command expg,

i.e: a = const1 + const2 * expg( const3 * b(2+const4,j) / const1)

Is it expg other form of exponential or it's a variable that I'm missunderstanding?

Thanks in advance
 
Technology news on Phys.org
Triscas said:
Hi!

I have the next expression and I don't know what exactly mean the commands

a= dexp ((const1)* (b-298) / (b*298))

This one, I guess it's to calculate the exponential value of the expression giving a double precission.
Correct.

Triscas said:
But i didn't find any info about the command expg,

i.e: a = const1 + const2 * expg( const3 * b(2+const4,j) / const1)

Is it expg other form of exponential or it's a variable that I'm missunderstanding?

expg is not part of the Fortran standard. My guess would be that it is a user-defined function, but it could also be part of a specific computer manufacturer's version of Fortran.
 
DrClaude said:
expg is not part of the Fortran standard. My guess would be that it is a user-defined function, but it could also be part of a specific computer manufacturer's version of Fortran.

Thanks, now I understand why I didn't find information about the function.

How could I figure it out the exact meaning? Using debugging options?
 
Triscas said:
How could I figure it out the exact meaning? Using debugging options?

You have to find where the function is coded if it is user-defined, or what computer the program was originally written for, depending on where the function is defined. Is expg declared "external" in the subroutine (or main program) where it is used?
 
DrClaude said:
You have to find where the function is coded if it is user-defined, or what computer the program was originally written for, depending on where the function is defined. Is expg declared "external" in the subroutine (or main program) where it is used?


In the main program the first time expg appears is already as a function " e1=expg(-arg)", it isn't declare and i don't find the computer the program was written for, though i have a lot of info about it.

I don't understand where could it be defined if it's out of the program, how can it be used?
 
Triscas said:
In the main program the first time expg appears is already as a function " e1=expg(-arg)", it isn't declare and i don't find the computer the program was written for, though i have a lot of info about it.
Is it possible for me to see a copy of the program?

Triscas said:
I don't understand where could it be defined if it's out of the program, how can it be used?
If it is not in the program, it is in one of the libraries that the linker links to during compilation. Fortran is special in that many manufacturers (IBM, Cray, etc.) came up with their own extensions to the language, supplementing what was considered to be missing in the Fortran 77 standard. It is not uncommon in legacy programs to find things that are specific to an old machine, an extinct dinosaur of which the fossilized remains are all that are left :smile:
 
I've had a look at the program, and it is indeed a user-defined function. If you look in the code, you will find

double precision function expg(x)
implicit real*8 (a-h,o-z)
expg=0.d0
if(x.gt.-700.d0) expg=dexp(x)
return
end

It is just the exponential function with a truncation for very small values of the exponential (probably to prevent underflow).
 
My bad, I had presumed it should be at the beginning of the code.

Thanks again for the quickness.

Doubt solved!
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
7K
  • · Replies 3 ·
Replies
3
Views
5K
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
17K
  • · Replies 18 ·
Replies
18
Views
7K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K