PDA

View Full Version : Version 3.5 Arc Tan


Mark Bresler
09-08-09, 11:40 AM
Hi,
I have read and reread the description of FATAN and FATAN2, and still cannot figure out how to use them. What are the limits for input numbers? Is there an equivalent word with degrees out rather than radians, or do I need to multiply by a constant?

Thanks,
Mark

RMDumse
09-08-09, 03:10 PM
Arctan or Atan is a pretty well known function. The F just adds the concept of floating point. Perhaps a google search would help you understand the basics.

The tangent is the ratio of cosine over sine. So thinking in terms of a unit circle and a right triangle with the unit circle radius as the hypotenous of the triangle, we can think of the tangent as the ratio of the opposite over the adjacent side. So given the angle of the triangle, we can comput the ratio. Then if we know one side (or the other) we can use that ratio to figure out the other side.

So an inverse function of tangent (artangent or arctan or atan or in our language FATAN) works from ratio back to angle.

What can the input to FATAN be, then? Any real number that represents the ratio of one side (opposite) of a triangle to another (adjacent). So given equal sides, the ratio would be 1. If a trinagle has sides 2.0 long, or 20000.0 long, the ratio is still 1:1. So the result of the arctan would be pi/4 or 45 degrees. Since FATAN results in radians, the answer would be .7584..

Other ratios will give other results, but the result will always represent the angle formed by the adjacent and opposite sides.

If you want to convert radians to degrees, it's easy. Multiply the radian result by 57.2957795 degrees/radian. But for internal operations, it is better to keep the results in radians, which the floating point package counts on.

HTH's

RMDumse
09-08-09, 03:13 PM
Oh, forgot to explain FATAN2. This is a simpler version where you don't supply the ratio already divided, you just give the two sides on the floating point stack, and the word works from the undivided sides rather than the ratio for itself.

Mark Bresler
09-08-09, 05:08 PM
I guess I did not explain my question well. For the arguments in should it be in the form FFFF.FFFF = X ,DDDD.DDDD = Y ? How many digits on each side of the decimal point?
Thanks,
Mark

RMDumse
09-08-09, 05:24 PM
Oh, inputs. They need to be floats. So they need to go on the floating point stack, in foating point form.

For instance, 1.0e0 or 1E0 gets you a 1 on the floating point stack, so

1E0 FATAN F. should print the .758398 number.

52E0 52E0 FATAN2 F. should be the same.

Floats have about seven (and a half) decimal digits of accuracy. How many places are printed are under your control, with iirc the word PLACES.