[ ] conforms to ANS Forth. iForth (Marcel Hendrix) VFX Forth for Windows, Linux, DOS (Stephen Pelc) [ ] already implements the proposal in full since release [ ]. iForth 0 (Marcel Hendrix) 4th 3.5d with ANS Float (Hans Bezemer) VFX Forth for Windows, Linux, DOS 3.7 (Stephen Pelc) [ ] implements the proposal in full in a development version. 4th with ZEN Float (Hans Bezemer) [ ] will implement the proposal in full in release [ ]. [ ] will implement the proposal in full in some future release. [ ] There are no plans to implement the proposal in full in [ ]. [ ] will never implement the proposal in full.
[ ] I have used (parts of) this proposal in my programs.
David N. Williams
Marcel Hendrix
Hans Bezemer
[ ] I would use (parts of) this proposal in my programs if the systems
I am interested in implemented it.
David N. Williams
Marcel Hendrix
[ ] I would use (parts of) this proposal in my programs if this
proposal was in the Forth standard.
David N. Williams
Marcel Hendrix
Ed Falat
[ ] I would not use (parts of) this proposal in my programs.
This problem has plagued one of my programs for quite along time since 1982. Just in the last month I figured out why it is not a problem in nature. It is quantized, you 2,3,4 etc. n principle values only.
Author: Charles G. Montgomery
Problem
The ANS definition is:
12.6.2.1489 FATAN2
f-a-tan-two FLOATING EXT ( F: r1 r2 -- r3 ) or ( r1 r2 -- r3 )
r3 is the radian angle whose tangent is r1/r2. An ambiguous condition
exists if r1 and r2 are zero.
This is incomplete, since it does not specify which of the countably
infinite set of angles satisfying this specification will be returned as r3.
Other computer languages which provide this function commonly specify the
"principal angle", the one between -pi and pi.
Proposal
The first sentence of the definition should be expanded to:
r3 is the principal radian angle (between -pi and pi)
whose tangent is r1/r2.
Another sentence should be added:
A system which returns FALSE for -0E 0E 0E F~ shall return a value
(approximating) -pi when r1=-0E and r2 is negative.
Remarks
This rewording follows the suggestion by Peter Knaggs that the language
follow the pattern used in the definition of FACOS, FASIN, and FATAN (but
with an added clarification of the term "principal").
Discussions in comp.lang.forth have included general agreement that the
present definition is ambiguous, probably unintentionally, and that specifying
the principal angle would be the favored correction.
The second sentence calls for behavior similar to other languages, such as C
and Fortran, is consistent with much modern hardware, and its omission would
impose an unnecessary burden on system providers, since most systems supporting
negative zero follow IEEE floating point behavior which behaves this way.
The wording of the second sentence has been chosen to be unambiguous without
the need for any new environmental query (even if F~ does not behave properly).
It has been suggested that additional Forth200x extensions be added to cover
support for negative zeros or perhaps general IEEE floating point behavior.
If such extensions become accepted and provide an environmental query that
would be useful for specifying the bahavior of FATAN2, it would be very easy
to make (yet another) modification to the specification of FATAN2, to make use
of them.
Experience
A summary quoted from a posting by David N. Williams in comp.lang.forth:
FATAN2 CONVENTIONS
implementation -pi to pi 0 to 2pi
--------------------------------------
pfe 0.33.70 yes no
gforth 0.7.0 yes no
kforth 1.4.0 yes no
iForth 3.0.3 yes no
4tH 3.5c yes no
SwiftForth 3 no yes
VFX Forth 4 yes no
Win32Forth 6.13.00 yes no
Testing
Tests
Note that you can be both a system implementor and a programmer, so you can submit both kinds of ballots.
[ ] conforms to ANS Forth. [ ] already implements the proposal in full since release [ ]. [ ] implements the proposal in full in a development version. [ ] will implement the proposal in full in release [ ]. [ ] will implement the proposal in full in some future release. [ ] There are no plans to implement the proposal in full in [ ]. [ ] will never implement the proposal in full.If you want to provide information on partial implementation, please do so informally, and I will aggregate this information in some way.
[ ] I have used (parts of) this proposal in my programs.
[ ] I would use (parts of) this proposal in my programs if the systems
I am interested in implemented it.
[ ] I would use (parts of) this proposal in my programs if this
proposal was in the Forth standard.
[ ] I would not use (parts of) this proposal in my programs.
If you feel that there is closely related functionality missing from the
proposal (especially if you have used that in your programs), make an
informal comment, and I will collect these, too. Note that the best time
to voice such issues is the RfD stage.