1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Fortran help: high precision intrinsic functions (kind = 16)

  1. Apr 10, 2012 #1
    Fortran help: high precision intrinsic functions (kind = 16)......

    1. The problem statement, all variables and given/known data
    Dear Everyone,
    I am using Fortran G95 compiler in windows 7 with SciTE as text editor. I have successfully compiled many programs (so there is no problem with my installations). I am having problems with quad-precision data. When ever I call an intrinsic functions with argument whose data type is quad-precision (kind = 16), I get an error message. If I change the data type to kind = 8 or kind = 10, I get no errors. Unfortunately, I need high precision results where I need to use kind = 16. Can anyone help me with this problem? Any help would be greatly appreciated.

    2. Relevant equations

    A simple code is:

    program test2
    implicit none
    real(kind = 16) :: x, y

    x = 0.8

    y = sin(x)

    print *, x
    print *, y

    end program test2

    and the generated error is:

    >g95 -fimplicit-none -W -Wall "test2.f95" -o "test2.exe"
    C:\Users\Net\AppData\Local\Temp/ccwBsKIo.o:test2.f95:(.text+0x35): undefined reference to `_g95_sin_r16'
    >Exit code: 1

    3. The attempt at a solution
  2. jcsd
  3. Apr 11, 2012 #2
    Re: Fortran help: high precision intrinsic functions (kind = 16)......

    It would appear that the compiler is generating the function call to the high precicision sin function but it's not found by the linker.

    Try doing arithmetic instead of sin and see if you still get the error. If not, you are missing some libraries.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook