Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran intrinsic functions source code

  1. Jul 8, 2012 #1
    Hi

    How can I see the source codes used for defining intrinsic functions in Fortran 90/95 ?
    e.g. what is the actual program for sqrt ?

    thanks
     
  2. jcsd
  3. Jul 8, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    The code is generated by the compiler. If the compiler has an option to output assembly code, you can look at the assembly code output by the compiler. Otherwise, you'll need to use a debugger using it's dissassembly mode in order to look at the generated code.
     
  4. Jul 8, 2012 #3
    Well I meant the programs written for intrinsic functions like sin and cos and sqrt. These programs are based on some mathematical algorithms. For example, sqrt might be exploiting some mathematical algorithm to find the square root. Somebody must have written these
    programs long ago. How can I see it ?
     
  5. Jul 8, 2012 #4

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

  6. Jul 8, 2012 #5
    Thanks Alephzero, I think even gfortran is open source too. Are their source codes open for download too ?
     
  7. Jul 9, 2012 #6

    AlephZero

    User Avatar
    Science Advisor
    Homework Helper

    Well, if "open source" doesn't mean "the source is available", something's wrong somewhere :smile:

    FWIW gfortran was the first place I looked for a link but I couldn't find one (but my attention span looking for it was only about 30 seconds).
     
  8. Jul 9, 2012 #7

    rcgldr

    User Avatar
    Homework Helper

    Much of those functions are implemented as floating point instructions in hardware. The hardware has internal algorithms, some of which include tables to produce initial values to speed up the algorithms. I'm not sure where you could get this information, as it is probably proprietary.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Fortran intrinsic functions source code
  1. The Source Code! (Replies: 15)

Loading...