Unraveling the Mystery of 'rfac' in Fortran

In summary, A user is seeking help in understanding the function 'rfac' in a Fortran code they are trying to use in Matlab. Other users suggest that it may be a locally defined variable or function and recommend doing a text search for it in the code. They also suggest using the 'grep' function on Linux to gain insight on its usage.
  • #1
mushi
23
0
Hi guys,

I know I may sound stupid to me many of you but can anybody tell me what does 'rfac' do in Fortran.
 
Engineering news on Phys.org
  • #2
I don't understand your question. Can you provide some context?
 
  • #3
Actually I am working on a code that has been written by someone else and I found 'rfac(X)' in that code. The code is written in Fortran and I am trying to use it in Matlab. I have checked everywhere but could not find any function named 'rfac'.

I hope I am clear now.
 
  • #4
my guess is it's a locally defined variable or function.

a google search on 'rfac fortran' turns up lots of incidences but in ones i found it was defined in the code.
maybe something passed to a sub?

can you do text search on the program?
 
  • #5
have you done a text search for rfac in all your fortran sources? I usually work on Linux and a 'grep' for a given function or variable name returns all the places where is being used...you can gain a lot of insight very quickly by viewing all the usage for a given variable/function.
 

1. What is 'rfac' in Fortran?

'rfac' is a built-in function in Fortran that stands for "real fractional accuracy." It is used to calculate the smallest increment between two real numbers that can be represented accurately in the computer's memory.

2. How is 'rfac' calculated?

'rfac' is calculated by taking the absolute value of the difference between two real numbers and dividing it by the larger of the two numbers. This gives the smallest increment between the two numbers that can be represented accurately.

3. Why is 'rfac' important in Fortran?

'rfac' is important in Fortran because it allows for precise calculations and comparisons of real numbers. It helps to avoid rounding errors and ensures accurate results in scientific and numerical computations.

4. Can 'rfac' be modified or changed?

No, 'rfac' is a built-in function in Fortran and cannot be modified or changed by the user. However, there are other methods and techniques that can be used to improve the accuracy of calculations in Fortran programs.

5. Are there any alternatives to using 'rfac' in Fortran?

Yes, there are alternative methods for calculating real fractional accuracy in Fortran such as the ISO_FORTRAN_ENV module, which includes the built-in function 'epsilon' for determining the smallest increment between two real numbers. Additionally, some compilers may have their own built-in functions or options for improving accuracy in calculations.

Similar threads

  • Computing and Technology
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
3
Views
1K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
2
Replies
62
Views
10K
  • Programming and Computer Science
Replies
16
Views
1K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
2
Replies
37
Views
3K
  • Programming and Computer Science
Replies
17
Views
4K
Back
Top