New Reply

Fortran intrinsic functions source code

 
Share Thread Thread Tools
Jul8-12, 06:10 PM   #1
 

Fortran intrinsic functions source code


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
PhysOrg.com
PhysOrg
science news on PhysOrg.com

>> 'Whodunnit' of Irish potato famine solved
>> The mammoth's lament: Study shows how cosmic impact sparked devastating climate change
>> Curiosity Mars rover drills second rock target
Jul8-12, 06:33 PM   #2
 
Recognitions:
Homework Helper Homework Help
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.
Jul8-12, 06:50 PM   #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 ?
Jul8-12, 08:34 PM   #4

Math 2012
 
Recognitions:
Science Advisor Science Advisor

Fortran intrinsic functions source code


You should be able to see the library source code for open source compliers, for example http://www.g95.org/downloads.shtml

But don't expect the code will mean much, unless you already know a lot of numerical analysis. Start here: http://www.amazon.com/Elementary-Fun.../dp/0138220646
Jul8-12, 11:39 PM   #5
 
Thanks Alephzero, I think even gfortran is open source too. Are their source codes open for download too ?
Jul9-12, 07:16 AM   #6

Math 2012
 
Recognitions:
Science Advisor Science Advisor
Well, if "open source" doesn't mean "the source is available", something's wrong somewhere

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).
Jul9-12, 01:11 PM   #7
 
Recognitions:
Homework Helper Homework Help
Quote by issacnewton View Post
Well I meant the programs written for intrinsic functions like sin and cos and sqrt.
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.
New Reply
Thread Tools


Similar Threads for: Fortran intrinsic functions source code
Thread Forum Replies
FORTRAN- Same source code compiled with different compilers gives different output Programming & Comp Sci 6
Fortran help: high precision intrinsic functions (kind = 16)...... Engineering, Comp Sci, & Technology Homework 1
Fortran - compilator dependent, intrinsic array manipulation, memory problem Programming & Comp Sci 1
Convert latex code to fortran code? Math & Science Software 1
Fortran 90 Intrinsic Function Programming & Comp Sci 0