Re: IEEE 754 vs Fortran arithmetic

Bennet Yee <bsy+@CS.CMU.EDU>
Sun, 28 Oct 90 03:03:38 GMT

          From comp.compilers

Related articles
[5 earlier articles]
Re: IEEE 754 vs Fortran arithmetic wsb@eng.Sun.COM (1990-10-25)
Re: IEEE 754 vs Fortran arithmetic eggert@twinsun.com (1990-10-25)
Re: IEEE 754 vs Fortran arithmetic wsb@eng.Sun.COM (1990-10-25)
Re: IEEE 754 vs Fortran arithmetic sjc@key.COM (1990-10-26)
Re: IEEE 754 vs Fortran arithmetic diamond@tkov50.enet.dec.com (1990-10-15)
Re: IEEE 754 vs Fortran arithmetic tim@ksr.com (Tim Peters) (1990-10-27)
Re: IEEE 754 vs Fortran arithmetic bsy+@CS.CMU.EDU (Bennet Yee) (1990-10-28)
Re: IEEE 754 vs Fortran arithmetic mcohen@amsaa-seer.brl.mil (Marty Cohen) (1990-10-30)
| List of all articles for this month |

Newsgroups: comp.compilers,comp.lang.fortran
From: Bennet Yee <bsy+@CS.CMU.EDU>
Keywords: Fortran, arithmetic
Organization: Cranberry Melon, School of Cucumber Science
References: <9010230628.AA22160@admin.ogi.edu> <BURLEY.90Oct24025053@world.std.com> <2408@charon.cwi.nl>
Date: Sun, 28 Oct 90 03:03:38 GMT

In article <2408@charon.cwi.nl>, dik@cwi.nl (Dik T. Winter) writes:
|> ... We are working on the
|> standardization of elementary mathematical functions in Ada. The current
|> status is that the basic package of functions like SINE, COSINE etc. is
|> very near to standardization. One of the functions included is:
|> ARCTAN(Y, X)
|> which returns the arctangent of Y/X. (Fortran users will recognize the
|> ATAN2 function.) The specification tells us that the result is the range
|> from -PI to +PI (approximately). The problem is, what is the result of
|> ARCTAN(Y, zero). Does it depend on the sign of zero? Offhand I do not
|> know what the Fortran standard tells us.


Is there something I'm missing? As far as I knew,


ARCTAN(Y,0) = pi/2 if Y > 0
-pi/2 if Y < 0


regardless of the sign on the zero. If Y = 0, then it's not well defined.
(I don't recall what 754 has to say about this case.)


Perhaps the problem occurs when you compute


ARCTAN(0,X)


when X<0? Assuming that you want the range to be from -pi to +pi, you can
argue that the answer should depend on the sign on 0: if the zero is
negative, then use -pi; otherwise use pi.


In some sense, this isn't really a problem with signed zeros but rather more
a problem with the discontinuity in the definition of the inverse
tangent....


Bennet S. Yee, +1 412 268-7571
School of Cucumber Science, Cranberry Melon, Pittsburgh, PA 15213-3890
Internet: bsy+@cs.cmu.edu Uunet: ...!seismo!cs.cmu.edu!bsy+
Csnet: bsy+%cs.cmu.edu@relay.cs.net Bitnet: bsy+%cs.cmu.edu@cmuccvma
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.