Re: Is Fortran more accurate than Java ?
From: Tom McGlynn (tam_at_lheapop.gsfc.nasa.gov)
Date: 06/30/04
- Next message: Roedy Green: "Re: Singleton Question"
- Previous message: Roedy Green: "Re: Singleton Question"
- In reply to: Andrea Polci: "Re: Is Fortran more accurate than Java ?"
- Next in thread: Roedy Green: "Re: Is Fortran more accurate than Java ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jun 2004 10:41:03 -0700
Andrea Polci <b_apolci@libero.it> wrote in message news:<l0jEc.10841$%l2.3646@news.edisontel.com>...
> Tom McGlynn wrote:
> > ...
> >
> > This approach has strengths and weaknesses. Fortran is far more portable
> > than Java since it doesn't specify a detailed arithmetic model.
>
> When you say "Fortran is far more portable than Java" you mean:
>
> 1) The Fortan compiler is more portable
>
> 2) A program written in Fortran is more portable
>
> May be 1) is true but 2) is false, based on what you ar saying. And
> programmers are more interested in 2) than in 1)
>
> Users in java don't have to care about the specific implementation of
> the wirtual machine. They know that int or double means every time the
> same thing.
>
> This is what I call a portable language.
>
> May be Fortran is more efficient (in aritmetic calculations) tha Java,
> cause the implementation don't have to reproduce a behavior that can
> differ from the one produced by the hardware.
>
> Andrea
Portability has a variety of shadings. I'd tend to think of it
as being able to move a working program to another machine/environment
easily. In this context it's certainly easy to move Java programs
amongst environments that support the JVM. On the other hand it's
hard to implement the JVM (at least with any efficiency)
on any environment that doesn't use two complements integers and
IEEE real arithmetic. So if there is a JVM in the destination
environment, a Java program probably ports pretty easily, but if
not one may be entirely out of luck.
Fortunately (though certainly not by coincidence), there was far
greater agreement amongst computer manufacturers about
the arithmetic models to be used at the time Java was developed than
when
Fortran was originally developed, so that this restricted model
is not as limiting as it would have been even as late as 1985 or even
1990.
There are still plenty of machines for which it is a problem but they
don't seem to have much market share (and I suppose emulators can
be used when efficiency is not an issue).
Even the first release of Java did run into this issue. Most
implementations
of Java 1.0 on PC's were non-compliant with the restrictive arithemtic
model that was in the original standard -- I think this includes
Sun's own implementation for PCs. The next release loosened
the requirements on the model a little to make reasonably efficient
implementations on PCs feasible.
That's why I said in my earlier message that Fortran is more portable
since it can fit naturally into a much wider variety of environments
than Java can, e.g., even on machines which use decimal rather than
binary numbers. I could run the first program I wrote, a random
numbers
finder, on the IBM 1620 and I believe it would probably run correctly
with
essentially no changes on the computer I'm writing this on -- though
I've long since lost the cards it was punched on. I find it unlikely
that there will be a port of Java to the IBM 1620 so here's a test
of portability where Fortran might win...
However that same flexibility means that legal Fortran
programs can and do give somewhat different results on different
machines
or even on the same machine using different compilers. Usually this
isn't an issue, but it can occasionally be a real problem.
For most of us peons who need to port software from one machine to
another
this is rarely an issue that we need to address. Occasionally it
might come up when we consider the language in which we are going
to write an application. However, both Java and standard Fortran are
very
widely portable among the machines commonly in use today.
So other differences between the languages usually dominate that
choice.
Note that most Fortran compilers provide support for extensions to the
language. Most issues with portability of Fortran programs arise from
use of such extensions rather than constructs within the language
standard. These
are sometimes comparable to the concerns that many Java programmers
have in trying to build portable code that runs efficiently in
multiple Java releases.
Regards,
Tom McGlynn
- Next message: Roedy Green: "Re: Singleton Question"
- Previous message: Roedy Green: "Re: Singleton Question"
- In reply to: Andrea Polci: "Re: Is Fortran more accurate than Java ?"
- Next in thread: Roedy Green: "Re: Is Fortran more accurate than Java ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|