[comp.lang.c] Atan2 and Hypot function speedup...

gceych@juliet.caltech.edu (Eychaner, Glenn C.) (12/23/90)

Ok, so maybe I'm not so smart.  After receiving many suggestions, including
METAFONT by Knuth and some new gadget called the cordic (course and direction
computer) functions which simulateously compute ATAN2 and HYPOT, I realized
that I was taking the result of ATAN2 and shoving it back through TAN! (duh...)
8-}   SO now all I need to do is speed up the HYPOT section.....any suggestions
(I need the Pythagorean HYPOT of two ints (or unsigned chars) returned as int.
Precision isn't that important (the nearest int is more than enough).)
Duh....... 
Glenn Eychaner    | Eychaner@SunCub.Caltech.edu | "We demand rigidly defined
40386 N Shore Ln  | gceych@iago.caltech.edu     |  areas of doubt and
Big Bear City, CA | Big Bear Solar Observatory  |  uncertainty!"
            92314 | !*** G O   N I N E R S ***! |                 -D. Adams

gceych@juliet.caltech.edu (Eychaner, Glenn C.) (12/23/90)

In article <1990Dec22.200215.20898@nntp-server.caltech.edu>, gceych@juliet.caltech.edu (Eychaner, Glenn C.) writes...
>Ok, so maybe I'm not so smart.  After receiving many suggestions, including
>METAFONT by Knuth and some new gadget called the cordic (course and direction
>computer) functions which simulateously compute ATAN2 and HYPOT, I realized
>that I was taking the result of ATAN2 and shoving it back through TAN! (duh...)
>8-}   SO now all I need to do is speed up the HYPOT section.....any suggestions
>(I need the Pythagorean HYPOT of two ints (or unsigned chars) returned as int.
>Precision isn't that important (the nearest int is more than enough).)
>Duh....... 

Double duh...I take the ATAN followed by the TAN in order to add in an
offset angle between the two steps....so send in those ideas!
i.e. tan (atan2 (a, b) + x)

Glenn Eychaner    | Eychaner@SunCub.Caltech.edu | "We demand rigidly defined
40386 N Shore Ln  | gceych@iago.caltech.edu     |  areas of doubt and
Big Bear City, CA | Big Bear Solar Observatory  |  uncertainty!"
            92314 | !*** G O   N I N E R S ***! |                 -D. Adams

brnstnd@kramden.acf.nyu.edu (Dan Bernstein) (12/23/90)

In article <1990Dec22.201442.21109@nntp-server.caltech.edu> gceych@juliet.caltech.edu writes:
> i.e. tan (atan2 (a, b) + x)

What does this have to do with C?

If you asked this question in comp.graphics, you might be told to
precompute sin x and cos x, and then to compute a cos x + b sin x
divided by -a sin x + b cos x. Or to look up rotations in any
high-school trigonometry text. And to explain what you're really
trying to do next time you ask a general programming question.

---Dan