View previous topic :: View next topic |
Author |
Message |
pmsagdeo
Joined: 30 May 2007 Posts: 3
|
Posted: Sun Jun 17, 2007 1:44 am Post subject: epsilon |
|
|
The FTN 95 does not seem to have implemented epsilon. Intel FORTRAN 9.0 does. Any idea if this is going to implemented. Or is it there in the paid version. Thanks.
Pradip Sagdeo |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sun Jun 17, 2007 7:44 am Post subject: |
|
|
I am not familiar with the Intel Fortran epsilon.
It is not Standard Fortran and it is not implemented in any version of FTN95.
There is a Fortran 90 standard intrinsic called EPSILON that is available and gives
EPSILON(X) = b ** (1-p)
where ** means "raised to the power"
b is the base used by the processor
p is the number of significant digits in X. |
|
Back to top |
|
|
pmsagdeo
Joined: 30 May 2007 Posts: 3
|
Posted: Sun Jun 17, 2007 12:47 pm Post subject: epsilon |
|
|
I tried to use it, but did not get the expected result. It did however function correctly under the INTEL compiler. Hence the question. Thanks.
Pradip |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Sun Jun 17, 2007 5:08 pm Post subject: |
|
|
If you are saying that the standard intrinsic EPSILON is not giving the expected result could you post sample code together with the result and the result you expect.
Thanks. |
|
Back to top |
|
|
pmsagdeo
Joined: 30 May 2007 Posts: 3
|
Posted: Sun Jun 17, 2007 6:26 pm Post subject: epsilon |
|
|
Yes, will do that as soon as I finish the business at hand. Thanks.
Pradip |
|
Back to top |
|
|
JohnCampbell
Joined: 16 Feb 2006 Posts: 2554 Location: Sydney
|
Posted: Wed Jun 20, 2007 4:00 am Post subject: |
|
|
Pradip,
Do you have the correct kind value for your real variables ? You may have a more extensive error with differing default kinds.
program test
real*4 x4
real*8 x8
real*10 x10
write (*,*) 'real*4', epsilon (x4)
write (*,*) 'real*8', epsilon (x
write (*,*) 'real*10', epsilon (x10)
end program test
gives:
Program entered
real*4 1.192093E-07
real*8 2.220446049250E-16
real*10 1.08420217248550444E-19
What were you expecting ?
John |
|
Back to top |
|
|
|