|
|
 |
 |
 |
 |
Fortran Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
Fortran DINT help
Hi. I am dealing with convert a fortran 77 program to java.But i have some problems in Fortran DINT ,truncation function and return values. I do not understand the return values of subroutines concept of fortran 77.On the other hand,What is the functionality of DINT function.Is there any java function that deals with this issue. I will be appreciated if you help with some examples Thanks..
mustafaalper @gmail.com wrote: > Hi. > I am dealing with convert a fortran 77 program to java.But i have > some problems in Fortran DINT ,truncation function and return values. > I do not understand the return values of subroutines concept of > fortran 77.On the other hand,What is the functionality of DINT > function.Is there any java function that deals with this issue.
DINT is simply the f66 intrinsic version for making an integer from a double, truncating toward 0. There is no reason in f77 or beyond for using DINT rather than generic INT. What do you mean, "issue?"
On Apr 30, 4:11 pm, Tim Prince <timothypri@sbcglobal.net> wrote: > mustafaalper @gmail.com wrote: > > Hi. > > I am dealing with convert a fortran 77 program to java.But i have > > some problems in FortranDINT,truncation function and return values. > > I do not understand the return values of subroutines concept of > > fortran 77.On the other hand,What is the functionality ofDINT > > function.Is there any java function that deals with this issue. > DINTis simply the f66 intrinsic version for making an integer from a > double, truncating toward 0. There is no reason in f77 or beyond for > usingDINTrather than generic INT. What do you mean, "issue?"
i mean that the input and output of dint function. output of dint(X) function is an integer or double.? dint(0.75xxxxxxxx) returns 0.75? I need examples for this. actually i am trying to to in Java. thanks for your help by the way..
mustafaalper @gmail.com wrote: > i mean that the input and output of dint function. > output of dint(X) function is an integer or double.? > dint(0.75xxxxxxxx) returns 0.75?
dint(0.75d0) returns 0d0. Only double precision kind works. aint is safe to use on any real kind, returns same kind as argument. anint(.75) returns 1. int(.75) returns 0 (default integer kind).
On Apr 30, 4:57 pm, Tim Prince <timothypri@sbcglobal.net> wrote: > mustafaalper @gmail.com wrote: > > i mean that the input and output of dint function. > > output of dint(X) function is an integer or double.? > > dint(0.75xxxxxxxx) returns 0.75? > dint(0.75d0) returns 0d0. Only double precision kind works. > aint is safe to use on any real kind, returns same kind as argument. > anint(.75) returns 1. > int(.75) returns 0 (default integer kind).
Ok i see.. Thank you for your help.i really appreciate it..
mustafaalper @gmail.com wrote: > Hi. > I am dealing with convert a fortran 77 program to java.But i have > some problems in Fortran DINT ,truncation function and return values. > I do not understand the return values of subroutines concept of > fortran 77.On the other hand,What is the functionality of DINT > function.Is there any java function that deals with this issue. > I will be appreciated if you help with some examples > Thanks..
Mustafa, It will help to have a good Fortran 77 Language Reference available. For example, look at http://www.sinc.sunysb.edu/UNIX/compilers/fortran/f77rm/index.html . For DINT, look at the section on Intrinsic Functions. In Fortran, there are two basic types of subprograms: subroutines and functions. Subroutines do not (in themselves) return a value--values are passed to and from the subroutine through the argument list. Functions will have a return value. For intrinsic functions (such as DINT) refer to the language reference for the type of argument and type of return value. Note that DINT is an archaic dialect for the generic INT. It is most often found in very old code, or code written by old cod(g)ers or novices who are confused about (or ignorant of) what a generic function is. HTH. jondr - an old cod(g)er.
jon wrote:
(snip) (snip) > For intrinsic functions (such as DINT) refer to the language reference > for the type of argument and type of return value. Note that DINT is > an archaic dialect for the generic INT. It is most often found in > very old code, or code written by old cod(g)ers or novices who are > confused about (or ignorant of) what a generic function is.
DINT is the specific name for the generic AINT, which has a someone different use from INT. DINT and AINT are used when one wants to truncate the fractional part of a floating point value, but keep it in floating point form. The results if AINT(1e30) and INT(1e30) will likely be different (until 128 bit processors become popular). I still believe that DFLOAT(i) is easier to read than REAL(i,KIND(1.d0)), but I probably wouldn't use DINT over AINT. -- glen
glen herrmannsfeldt <g @ugcs.caltech.edu> wrote: > I still believe that DFLOAT(i) is easier to read than > REAL(i,KIND(1.d0)), Well, I have trouble imagining anyone writing the REAL invocation in quite that style anyway. If you do write it that way, you loose the main advantages of the generic form, which makes it little wonder that you wouldn't see the advantages. A more likely form is more like READ(i,my_kind) where my_kind is a suitabel parameter (and is unlikely to actualy have that particular name). The big advantage of the generic form is portability. If you ever need to change to some other precision, you need to carefully hunt down all cases of specific intrinsics like dfloat, as well as other things such as literal constants in places where it matters. I've done that; it can be a lot of work. Actually, it can be a *LOT* of work, but I'd reserve that description for cases where you also have to deal with things like sequence association. -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain
On Apr 30, 6:05 pm, jon <jon_@msn.com> wrote:
> mustafaalper @gmail.com wrote: > > Hi. > > I am dealing with convert a fortran 77 program to java.But i have > > some problems in Fortran DINT ,truncation function and return values. > > I do not understand the return values of subroutines concept of > > fortran 77.On the other hand,What is the functionality of DINT > > function.Is there any java function that deals with this issue. > > I will be appreciated if you help with some examples > > Thanks.. > Mustafa, > It will help to have a good Fortran 77 Language Reference available. > For example, look athttp://www.sinc.sunysb.edu/UNIX/compilers/fortran/f77rm/index.html > . For DINT, look at the section on Intrinsic Functions. > In Fortran, there are two basic types of subprograms: subroutines and > functions. Subroutines do not (in themselves) return a value--values > are passed to and from the subroutine through the argument list. > Functions will have a return value. > For intrinsic functions (such as DINT) refer to the language reference > for the type of argument and type of return value. Note that DINT is > an archaic dialect for the generic INT. It is most often found in > very old code, or code written by old cod(g)ers or novices who are > confused about (or ignorant of) what a generic function is. > HTH. > jondr - an old cod(g)er.
thank you for your concern....
On Apr 30, 12:44 pm, glen herrmannsfeldt <g@ugcs.caltech.edu> wrote: > DINT is the specific name for the generic AINT, which has a someone > different use from INT. > DINT and AINT are used when one wants to truncate the fractional > part of a floating point value, but keep it in floating point form.
You are correct. IDINT remember that. jondr
|
 |
 |
 |
 |
|