Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Convert Fortran program to Java

Convert Fortran program to Java

Scheduled Pinned Locked Moved Java
helptutorialc++java
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Trupti Mehta
    wrote on last edited by
    #1

    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 Java are based differnt than Fortran. Fortran's double precision type is based on IEEE756. I want to know how to convert these double precision calculations into Java. For example:

    double precision d1 = 0.3648564D0;
    d1**2 // ** indicates exponent
    DSIN(d1) // sin of double precision
    DCOS(d1) // cos of double precision

    The above are my main concerns which I find very difficult to convert. I use Math.sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our java application is what I am looking for. If you can provide the same for C++ that would also be a plus for me, I will use the code accordingly of Java application. Please help me out. Am stuck up very badly.

    Thanks Terry

    T 1 Reply Last reply
    0
    • T Trupti Mehta

      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 Java are based differnt than Fortran. Fortran's double precision type is based on IEEE756. I want to know how to convert these double precision calculations into Java. For example:

      double precision d1 = 0.3648564D0;
      d1**2 // ** indicates exponent
      DSIN(d1) // sin of double precision
      DCOS(d1) // cos of double precision

      The above are my main concerns which I find very difficult to convert. I use Math.sin & cos for DSIN & DCOS. But Fortran 77 deals somthing differntly with double precision. How to convert/translate that into our java application is what I am looking for. If you can provide the same for C++ that would also be a plus for me, I will use the code accordingly of Java application. Please help me out. Am stuck up very badly.

      Thanks Terry

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      do you know something called "javadoc" ? ;P just kidding in java (and in C++), the type double handles such precision. then, you just have to call the correct functions, which you'll find reference in the online documentation. in C++, just #include <cmath> and use sin() and cos() like this. in Java, just call Math.sin() and Math.cos()...

      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups