Comp Sci Fortran help: high precision intrinsic functions (kind = 16)

AI Thread Summary
The user is experiencing issues with quad-precision intrinsic functions in Fortran using the G95 compiler, specifically when calling the sine function with a data type of kind = 16. The error message indicates an undefined reference to the high precision sine function, suggesting that the necessary libraries may not be linked correctly. When changing the data type to kind = 8 or kind = 10, the program compiles without errors, indicating the problem is specific to kind = 16. A suggested solution is to perform basic arithmetic operations to check if the error persists, which could confirm a library issue. Ensuring the correct libraries for quad-precision functions are included is essential for resolving this problem.
diamondback
Messages
1
Reaction score
0
Fortran help: high precision intrinsic functions (kind = 16)...

Homework Statement


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.

Homework 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

The Attempt at a Solution

 
Physics news on Phys.org


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.
 

Similar threads

Back
Top