Convert Fortran Code
-
Hi, I have a Fortran program which I have to convert into Java originally. I have converted the code completely but can't get appropriate resutls. The code contains lot of arithmetic calculations using double precision data type of Fortran. I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example:
double precision d1 = 0.3648564D0;
d1**2 // ** indicates exponent
DSIN(d1) // sin of double precision
DCOS(d1) // cos of double precisionThe above are my main concerns which I find very difficult to convert. I use sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our normal C++ application is what I am looking for. If you cna provide the same for Java that would be a plus for me, otherwise I will use the code accordingly of C++ in my Java application. Please help me out. Am stuck up very badly.
Thanks Terry
-
Hi, I have a Fortran program which I have to convert into Java originally. I have converted the code completely but can't get appropriate resutls. The code contains lot of arithmetic calculations using double precision data type of Fortran. I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example:
double precision d1 = 0.3648564D0;
d1**2 // ** indicates exponent
DSIN(d1) // sin of double precision
DCOS(d1) // cos of double precisionThe above are my main concerns which I find very difficult to convert. I use sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our normal C++ application is what I am looking for. If you cna provide the same for Java that would be a plus for me, otherwise I will use the code accordingly of C++ in my Java application. Please help me out. Am stuck up very badly.
Thanks Terry
Do you mean IEEE-754? C++ do use IEEE-754 to store the floating point numbers. In fact the floating point number format are implemented at the hardware level and Intel processors use IEEE-754. -Saurabh
-
Hi, I have a Fortran program which I have to convert into Java originally. I have converted the code completely but can't get appropriate resutls. The code contains lot of arithmetic calculations using double precision data type of Fortran. I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example:
double precision d1 = 0.3648564D0;
d1**2 // ** indicates exponent
DSIN(d1) // sin of double precision
DCOS(d1) // cos of double precisionThe above are my main concerns which I find very difficult to convert. I use sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our normal C++ application is what I am looking for. If you cna provide the same for Java that would be a plus for me, otherwise I will use the code accordingly of C++ in my Java application. Please help me out. Am stuck up very badly.
Thanks Terry
<blockquote class="FQ"><div class="FQA">Trupti Mehta wrote:</div>IEEE756</blockquote> Never head about. Do you mean
IEEE 754
?Trupti Mehta wrote:
I believe the data types of C++ and Java are based on same whereas of Fortran double precision is based on IEEE756. I want to know how to convert these double precision calculations into C++ normally. For example: double precision d1 = 0.3648564D0;d1**2 // ** indicates exponentDSIN(d1) // sin of double precisionDCOS(d1) // cos of double precision
Even if the
FORTRAN
double precision would based on a different standard, I believe the results of both programs (i.e. theFORTRAN
and theJava
one) should be comparable. Are you sure the logic of your translation is correct? Have you made a test to compare the results (given byFORTRAN
vsJava
) of such simple functions assin
andcos
? :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]