[E-Lang] Hydro & E operator expansions

Karp, Alan alan_karp@hp.com
Thu, 22 Mar 2001 09:00:27 -0800


I guess you guys are too young to remember the greatly appreciated addition
to Fortran II called "mixed mode operations".  Up until Fortran IV (Anybody
know what ever happened to Fortran III?), 3.1+4 produced an error.  After
that, it was coerced to floating point.  Coercion works for Fortran because
it only applies to the 3 types integer, real, and double precision.  When
there are more types, as in modern languages, coercion can be a problem.

By the way, I don't want to prevent a==b for floats.  I often use the test
to decide if the contents of the variables came from the same source, e.g.,

	b = a
	c = f(a)
	if ( b .eq. c ) call exit

	function f(a)
	   if ( a .gt. 0.0 ) return a
	   else return 0.0
	end

(Gosh, writing Fortran brings back some fond memories.)  The test is also
useful if INEXACT wasn't raised in computing b and c.  On the other hand, I
am in favor of a compiler warning when this construct is encountered.  (I'd
also like a warning on if(a=b), but that's because Fortran is my mother
tongue.) 

_________________________
Alan Karp
Principal Scientist
Decision Technology Department
Hewlett-Packard Laboratories MS 1U-2
1501 Page Mill Road
Palo Alto, CA 94304
(650) 857-3967, fax (650) 857-6278
https://ecardfile.com/id/Alan_Karp
http://www.hpl.hp.com/personal/Alan_Karp/