CfV: Ambiguity in FATAN2



  • 1. Julian Noble's Funeral
    Julian Noble died on 11 March 2007, his funeral will be in Charlottesville, Va. at the Hill & Woods on 1st & Market Street at 11 am 13 of March 2007.
  • 2. learning forth on linux or colorforth without?
    How do I learn an open source forth? Linux? what book? colorforth doesn't need linux? how do I load it then on a pc?
  • 3. questions from forth dimension 'fractal' code
    In Phil Koopman's fractal code from Vol IX, Number 1, pp 11-16 , there is a word "recurse" that I don't understand. : recurse latest pfa cfa , ; immediate : calculate-surface ( p1 p2 p3 p4 delta-h level# --) set-heights dup if square1 recurse square2 recurse square3 recurse square4 recurse then 3drop 3drop ; Also, does anyone recognize "1." and "+-"?

CfV: Ambiguity in FATAN2

Postby anton » Sun, 31 May 2009 04:43:04 GMT

uthor: Charles G. Montgomery

This is actually a poll about how widely the proposal is implemented
and how popular it is among the programmers. It is called a CfV
(call-for-votes) because the process is inspired by the Usenet Rdf/CfV

You find the actual ballot further down (look for "VOTING PROCEDURE"),
after the proposal on which you vote.


The ANS definition is: 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.


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.


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.


A summary quoted from a posting by David N. Williams in comp.lang.forth:

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



Fill out the appropriate ballot(s) below and mail it/them to me
< XXXX@XXXXX.COM >. Your vote will be published
(including your name (without email address) and/or the name of your
system) on You can vote (or
change your vote) at any time by mailing to me, and the results will
be published here.

Note that you can be both a system implemen

Similar Threads:

1.Ambiguity in FATAN2

2.RfD: Ambiguity in FATAN2 version 1.2

3.RfD: Ambiguity in FATAN2

4.RfD: Ambiguity in FATAN2

On Mar 24, 10:41m,  XXXX@XXXXX.COM  (Anton Ertl)
> "C. G. Montgomery" < XXXX@XXXXX.COM > writes:
> >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 radian angle, greater than -pi and less than or equal to pi,
> >whose tangent is r1/r2.
> The C standard specifies "[-pi,pi]", i.e., greater than or equal to
> -pi.
> And on Gforth (which uses C's atan2):
> -1e 0e fatan2 f.
> outputs
> -1.5707963267949
> and I guess that Gforth is not the only one.

W32F gives the same (assuming the precision is set to 14). Since pi
cannot be represented exactly shouldn't it be the closest
approximations of pi and -pi, allowing for rounding).

> So I suggest including -pi in the range.
> - anton

George Hubert

5.RfD: Ambiguity in FATAN2 version 1.1

6. RfD/CfV system (was: Current standings: CfV: Deferred words)

7. printf format ambiguity

8. Ambiguity in semantics of assignments?

Return to forth


Who is online

Users browsing this forum: No registered users and 88 guest