[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::fortran

Title:Digital Fortran
Notice:Read notes 1.* for important information
Moderator:QUARK::LIONEL
Created:Thu Jun 01 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1333
Total number of notes:6734

1250.0. "clog intrinsic - difference between f77 and f90" by HPCGRP::DEGREGORY (Karen 223-5801) Fri Apr 04 1997 09:35



For the code below, I get different answers when I use f77
and when I use Digital Unix f90 and/or Visual Fortran.

F77 generates (which I believe to be correct)

 avc= (0.9886114,3.141593)
 avc= (0.9886114,3.141593)
 avc= (0.9886114,3.141593)

F90 (UNIX and VISUAL)  generate

 avc= (0.9886114,3.141593)
 avc= (0.9886114,3.141593)
 avc= (0.9886114,-3.141593)


The minus sign on the imaginary value of the last avc is
incorrect.


***************cut here*******************
	complex avc

	AVC = CLOG((2.6875, 0.0) * (-1.0, 0.0))
	print*,"avc=",avc
	avc= clog((-2.6875,0.0))
	print*,"avc=",avc
	avc = clog(-(2.6875,0.0))
	print*,"avc=",avc
	end


T.RTitleUserPersonal
Name
DateLines
1250.1QUARK::LIONELFree advice is worth every centFri Apr 04 1997 11:274
How strange - I can reproduce this on UNIX and with DVF, but on VMS, I have
to use /FLOAT=IEEE to see this behavior...

			Steve
1250.2WIBBIN::NOYCEPulling weeds, pickin' stonesFri Apr 04 1997 11:582
That's because only IEEE floating point has a minus zero,
which is the source of this problem.
1250.3QUARK::LIONELFree advice is worth every centFri Apr 04 1997 12:117
Ah, yes... Now I see.

Fortran 95 has added language requiring that we be able to distinguish -0 from
+0, if the representation allows it.  -(2.6875,0.0) is (-2.6875,-0.0), and
it's reasonable that the CLOG intrinsic return -pi for the imaginary part.

				Steve
1250.4We will probably fix f77TLE::EKLUNDAlways smiling on the inside!Fri Apr 04 1997 13:558
    	I'm initially taking this as an f77 bug.  It looks like we were
    not real careful about how we negated the zero.  I believe the f90
    results to be the "more correct" if one likes to deal with the
    wonders of a system with a negative zero available...
    
    Cheers!
    Dave Eklund
    
1250.5FixedTLE::EKLUNDAlways smiling on the inside!Fri Apr 04 1997 18:426
    	Fixed.  We will negate the zero, hence giving the same result
    that f90 gives.
    
    Cheers!
    Dave Eklund
    
1250.6QUARK::LIONELFree advice is worth every centFri Apr 04 1997 22:383
    Karen, aren't you sorry you asked? :-)
    
    				Steve
1250.7kind ofHPCGRP::DEGREGORYKaren 223-5801Wed Apr 09 1997 15:469
Well, the interesting thing is that the test suite
from the National Bureau of Standards FAILS when
you use the f90 compiler and passes when you use
the f77 compiler.  That's why we thought that what
f77 was doing was the correct thing to do. KAI 
discovered this problem as part of their product
testing.

Karen
1250.8QUARK::LIONELFree advice is worth every centWed Apr 09 1997 15:493
Which FCVS test is that?

		Steve