From: baalzamon.moridin on
Howdy there,
I am converting some fortran 77 code into matlab. There are various
questions that have cropped up. As I prgress through my conversion
process i will add them to this topic. For now my first question is;
What is 0.0D0?
the context it is being used in is;
IF (A.NE.0.0D0) GOTO 20
As an initial guess I was thingking it is a 'precise' definition of
zero....? Thus if A is not 'exactly' to zero then jump to statement
20...
From: steve on
On May 26, 8:01 am, "baalzamon.moridin" <baalzamon.mori...(a)gmail.com>
wrote:
> Howdy there,
> I am converting some fortran 77 code into matlab. There are various
> questions that have cropped up. As I prgress through my conversion
> process i will add them to this topic. For now my first question is;
> What is 0.0D0?
> the context it is being used in is;
> IF (A.NE.0.0D0) GOTO 20
> As an initial guess I was thingking it is a 'precise' definition of
> zero....? Thus if A is not 'exactly' to zero then jump to statement
> 20...

Have you tried "Fortran tutorial" with your favor search engine?
Google seems to think that there are about 547000 possible sites
that might help.

Additionally, wikipedia's article is well written. It might
help with this and other questions.

To answer your question, 0.0d0 is a double precision literal
constant.

--
steve
From: Reinhold Bader on
Hello,

baalzamon.moridin schrieb:
> Howdy there,
> I am converting some fortran 77 code into matlab. There are various
> questions that have cropped up. As I prgress through my conversion
> process i will add them to this topic. For now my first question is;
> What is 0.0D0?

0.0D0 is a constant of type "double precision real", whereas 0.0 is a constant
of type "default real". Typically, today's implementations use a IEEE conforming
representation using 4 bytes for default reals, and 8 bytes for double precision
reals. Since zero is exactly representable, there will not be any difference
between 0.0 and 0.0D0 as far as evaluating the logical expression below is
concerned.

> the context it is being used in is;
> IF (A.NE.0.0D0) GOTO 20
> As an initial guess I was thingking it is a 'precise' definition of
> zero....? Thus if A is not 'exactly' to zero then jump to statement
> 20...

Regards
Reinhold
From: Richard Maine on
baalzamon.moridin <baalzamon.moridin(a)gmail.com> wrote:

> I am converting some fortran 77 code into matlab. There are various
> questions that have cropped up. As I prgress through my conversion
> process i will add them to this topic. For now my first question is;
> What is 0.0D0?

Double precision zero.

> the context it is being used in is;
> IF (A.NE.0.0D0) GOTO 20
> As an initial guess I was thingking it is a 'precise' definition of
> zero....? Thus if A is not 'exactly' to zero then jump to statement
> 20...

Well, sort of, but not really. The D0 means double precision. It does
not mean exact. On the other hand, the .NE. does mean exact - always.
That really has nothing to do with the D0. There is no such thing as a
"sort of equal" test in the language. You can code one yourself, and it
is even reasonably common to do so, but there is nothing like that built
into the language. On the third hand, zero is always going to be exact
in any precision anyway.

So the test does mean to jump if A is not exactly equal to zero, but
that has nothing to do with anything particularly closely related to the
D0.

The D0 is presumably (you don't show the declarations, so it is just a
guess, but probably a pretty good one) because the "A" is double
precision and it is considered best style to compare things of the same
precision. It is allowed to compare things of different precision, but
that is often discouraged because it can give surprising results. The
surprises won't happen for 0.0, but there is much to be said for
applying such rules of stylel consistently instead of trying to figure
out when you can get by without them.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: baalzamon.moridin on
I've tried a few rather simple tutorials, however, I do not have a
fortran compiler.
Furthermore I really do not want to end up having to learn fortran
beyond what i need for translation.
Though I will act upon your advice and look up some more tutorials.