Discussion:
Fortran DINT help
(too old to reply)
m***@gmail.com
2007-04-30 11:39:42 UTC
Permalink
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..
Tim Prince
2007-04-30 13:11:38 UTC
Permalink
Post by m***@gmail.com
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?"
m***@gmail.com
2007-04-30 13:26:56 UTC
Permalink
Post by m***@gmail.com
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..
Tim Prince
2007-04-30 13:57:10 UTC
Permalink
Post by m***@gmail.com
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).
m***@gmail.com
2007-04-30 14:49:48 UTC
Permalink
Post by Tim Prince
Post by m***@gmail.com
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..
jon
2007-04-30 15:05:01 UTC
Permalink
Post by m***@gmail.com
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.
glen herrmannsfeldt
2007-04-30 18:44:30 UTC
Permalink
jon wrote:

(snip)
Post by jon
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.
(snip)
Post by jon
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
Richard Maine
2007-04-30 18:01:43 UTC
Permalink
Post by glen herrmannsfeldt
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
jon
2007-05-01 15:23:42 UTC
Permalink
Post by glen herrmannsfeldt
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

m***@gmail.com
2007-05-01 12:30:23 UTC
Permalink
Post by jon
Post by m***@gmail.com
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....
Loading...