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

  • Fortran
  • Thread starter Triscas
  • Start date
  • Tags
    Fortran
In summary, the function expg is used to calculate the exponential value of an expression. It is found in the main program, and is a double precision function. If the value of the expression is greater than 700.00, the function truncates the exponential value.
  • #1
Triscas
9
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
  • #2
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.
 
  • #3
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?
 
  • #4
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?
 
  • #5
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?
 
  • #6
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:
 
  • #7
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).
 
  • #8
My bad, I had presumed it should be at the beginning of the code.

Thanks again for the quickness.

Doubt solved!
 

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

1. What is the purpose of the FORTRAN 77 commands expg and dexp?

The expg command is used to calculate the exponential function of a given value, while dexp is used to calculate the double precision exponential function. These commands are commonly used in scientific and mathematical calculations.

2. How do I use the expg and dexp commands in a FORTRAN 77 program?

To use these commands, you need to include the FORTRAN intrinsic module "mathlib" in your program. Then, you can call the expg and dexp commands with the desired input value as the argument.

3. Can I use the expg and dexp commands with arrays in FORTRAN 77?

Yes, these commands can be used with arrays in FORTRAN 77. However, you need to make sure that the array elements are of the appropriate type (real or double precision) to match the command being used.

4. Are the expg and dexp commands available in newer versions of FORTRAN?

Yes, these commands are still available in newer versions of FORTRAN, such as FORTRAN 90 and FORTRAN 95. However, they may have been replaced by more efficient or specialized functions in these newer versions.

5. What are some common errors that can occur when using the expg and dexp commands?

One common error is not including the "mathlib" module in your program, which will result in the compiler not recognizing the expg and dexp commands. Another error can occur if you use the wrong data type for the input value, or if the input value is too large or too small for the command to handle.

Similar threads

  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
6
Views
6K
  • Programming and Computer Science
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
6
Views
3K
  • Programming and Computer Science
Replies
4
Views
15K
  • Programming and Computer Science
Replies
18
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
0
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
Back
Top