|
|
1.1 root 1: .TH COS 3
2: .CT 2 math
3: .SH NAME
4: cos, sin, atan2, sqrt, norm \- integer math functions
5: .SH SYNOPSIS
6: .B int cos(d)
7: .B int d;
8: .PP
9: .B int sin(d)
10: .B int d;
11: .PP
12: .B int atan2(x, y)
13: .B int x, y;
14: .PP
15: .B int norm(x, y, z)
16: .B int x, y, z;
17: .PP
18: .B int sqrt(x)
19: .B long x;
20: .PP
21: .SH DESCRIPTION
22: .I Cos
23: and
24: .I sin
25: return scaled integer approximations to the trigonometric functions.
26: The argument values are in degrees.
27: The return values are scaled so that
28: .BR cos(0)==1024 .
29: Thus, to calculate the mathematical expression
30: .if t .IR x \|=\| a\^ cos( d ),
31: .if n .IR x = x0 *cos( d ),
32: the multiplication must be scaled:
33: .IP
34: .L
35: x = muldiv(x0, cos(d), 1024)
36: .PP
37: .I Atan2
38: returns the approximate arc-tangent of
39: .IR y / x .
40: The return value is in integral degrees.
41: .PP
42: .I Sqrt
43: returns the 16-bit signed integer closest to the
44: square root of its 32-bit signed argument.
45: .PP
46: .I Norm
47: returns the Euclidean length of the three-vector
48: .RI ( x ,
49: .IR y ,
50: .IR z ).
51: .SH DIAGNOSTICS
52: .I Sqrt
53: returns 0 for negative arguments; and
54: .BR atan2(0,0)==0.
55: .IR Norm
56: does not protect against overflow.
57: .SH BUGS
58: .I Atan2
59: may be off by as much as two degrees.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.