Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extended precision in g95 not working(?)

Status
Not open for further replies.

sim2007

Programmer
Jul 13, 2007
1
DE
Hi there. I am trying to test whether g95's extended precision works on my machine. My program to do this is as follows:

real*10 a
a=1.q0+1.q-15
print*, a,a-1.q0
a=1.q0+1.q-16
print*, a,a-1.q0
end

In other words I'm trying to see whether <number>-<very small number> makes a difference to <number>. If I just use double precision (changing real*10 to real*8), I get the following output:

1.000000000000001 1.1102230246251565E-15
1. 0.

Now with extended precision as above, I would expect the second line of output to be more interesting, however the calculational accuracy is similar - the output being

1.0000000000000011102 1.1102230246251565404E-15
1. 0.

Either:

1. I am not forcing extended precision correctly. Note that I compile with "x86_64-unknown-linux-gnu-g95 -r10 -o test test.f"

2. Extended precision is not available on my machine.

3. I have misunderstood extended precision altogether.

Which one? Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top