Thread: Fortran to C - dsin

  1. #1
    Registered User
    Join Date
    Jul 2010
    Location
    Liverpool
    Posts
    34

    Fortran to C - dsin

    Hi everyone,

    I know this is the C board but hopefully someone can help.

    I've been tasked with converting a FORTRAN program to C and am having problems with the 'DSIN' function, for example:

    Code:
    S         = DSIN(THETA)
    Where theta is 0.104, for example. Generally sin (0.104) is 0.104
    .
    I've found out the D means degrees.

    My question is, converting from FORTRAN to C, should I use
    Code:
    S = sin(theta)
    or 
    S = sin((180/pi)*theta)
    to get the same as the FORTRAN? The FORTRAN output appears to be the same as the first option, which would surely mean the 'D' bit of 'DSIN' is pointless?

    *confused*

  2. #2
    Registered User
    Join Date
    Jun 2010
    Location
    Michigan, USA
    Posts
    143
    Quote Originally Posted by snoikey View Post
    I've found out the D means degrees.
    In a quick search of the internet, it would appear to me that the D means double precision and not degrees.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Location
    Liverpool
    Posts
    34
    It looks like you're right, thank you! Trying to find the website I got 'degrees' from I can't.. oh well, thank you!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Calling Fortran Subroutine!!! COMPLEX!!!!
    By dustydude in forum C Programming
    Replies: 3
    Last Post: 06-14-2010, 10:38 PM
  2. Performance on par with Fortran 90/95
    By oacikgoz in forum C++ Programming
    Replies: 4
    Last Post: 04-15-2010, 06:09 AM
  3. real-world apps in C++ (preferably simple)?
    By Aisthesis in forum C++ Programming
    Replies: 13
    Last Post: 06-12-2009, 01:03 PM
  4. Linking Fortran procedures with C program
    By gest in forum C Programming
    Replies: 5
    Last Post: 07-14-2003, 12:35 PM
  5. any good fortran help sites
    By smd in forum C++ Programming
    Replies: 3
    Last Post: 07-02-2002, 06:10 AM