1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* |
4 |
|
|
* This program and the accompanying materials are made available under the |
5 |
|
|
* terms of the MIT License which is available at |
6 |
|
|
* https://opensource.org/licenses/MIT. |
7 |
|
|
* |
8 |
|
|
* SPDX-License-Identifier: MIT |
9 |
|
|
**************************************************************************/ |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
/**************************************************************************/ |
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/** */ |
15 |
|
|
/** GUIX Component */ |
16 |
|
|
/** */ |
17 |
|
|
/** Utility (Utility) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_utility.h" |
28 |
|
|
|
29 |
|
|
/**************************************************************************/ |
30 |
|
|
/* */ |
31 |
|
|
/* FUNCTION RELEASE */ |
32 |
|
|
/* */ |
33 |
|
|
/* _gx_utility_math_acos_5_4_0 PORTABLE C */ |
34 |
|
|
/* 6.1 */ |
35 |
|
|
/* AUTHOR */ |
36 |
|
|
/* */ |
37 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
38 |
|
|
/* */ |
39 |
|
|
/* DESCRIPTION */ |
40 |
|
|
/* */ |
41 |
|
|
/* This service computes the angle value of the arc cosine x. */ |
42 |
|
|
/* */ |
43 |
|
|
/* INPUT */ |
44 |
|
|
/* */ |
45 |
|
|
/* x Value whose arc cosine is */ |
46 |
|
|
/* computed, in the interval */ |
47 |
|
|
/* [-256, 256]. */ |
48 |
|
|
/* */ |
49 |
|
|
/* OUTPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* angle Angle value of arc cosine of x*/ |
52 |
|
|
/* */ |
53 |
|
|
/* CALLS */ |
54 |
|
|
/* */ |
55 |
|
|
/* _gx_utility_math_asin_5_4_0 Compute arc sin */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLED BY */ |
58 |
|
|
/* */ |
59 |
|
|
/* Application Code */ |
60 |
|
|
/* */ |
61 |
|
|
/* RELEASE HISTORY */ |
62 |
|
|
/* */ |
63 |
|
|
/* DATE NAME DESCRIPTION */ |
64 |
|
|
/* */ |
65 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
66 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
67 |
|
|
/* resulting in version 6.1 */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
|
#if defined(GUIX_5_4_0_COMPATIBILITY) |
71 |
|
|
INT _gx_utility_math_acos_5_4_0(INT x) |
72 |
|
|
{ |
73 |
|
|
INT angle = 0; |
74 |
|
|
|
75 |
|
|
angle = _gx_utility_math_asin_5_4_0(x); |
76 |
|
|
angle = 90 - angle; |
77 |
|
|
|
78 |
|
|
return angle; |
79 |
|
|
} |
80 |
|
|
#endif |
81 |
|
|
|
82 |
|
|
/**************************************************************************/ |
83 |
|
|
/* */ |
84 |
|
|
/* FUNCTION RELEASE */ |
85 |
|
|
/* */ |
86 |
|
|
/* _gx_utility_math_acos PORTABLE C */ |
87 |
|
|
/* 6.1 */ |
88 |
|
|
/* AUTHOR */ |
89 |
|
|
/* */ |
90 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
91 |
|
|
/* */ |
92 |
|
|
/* DESCRIPTION */ |
93 |
|
|
/* */ |
94 |
|
|
/* This service computes the angle value of the arc cosine x, which is */ |
95 |
|
|
/* an old version of _gx_utility_math_cos. */ |
96 |
|
|
/* */ |
97 |
|
|
/* INPUT */ |
98 |
|
|
/* */ |
99 |
|
|
/* x Value whose arc cosine is */ |
100 |
|
|
/* computed. The value is a */ |
101 |
|
|
/* fixed point math data type, */ |
102 |
|
|
/* call GX_FIXED_VAL_MAKE to do */ |
103 |
|
|
/* type conversion. */ |
104 |
|
|
/* */ |
105 |
|
|
/* OUTPUT */ |
106 |
|
|
/* */ |
107 |
|
|
/* angle Angle value of arc cosine of x*/ |
108 |
|
|
/* */ |
109 |
|
|
/* CALLS */ |
110 |
|
|
/* */ |
111 |
|
|
/* _gx_utility_math_asin Compute arc sin */ |
112 |
|
|
/* */ |
113 |
|
|
/* CALLED BY */ |
114 |
|
|
/* */ |
115 |
|
|
/* Application Code */ |
116 |
|
|
/* */ |
117 |
|
|
/* RELEASE HISTORY */ |
118 |
|
|
/* */ |
119 |
|
|
/* DATE NAME DESCRIPTION */ |
120 |
|
|
/* */ |
121 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
122 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
123 |
|
|
/* resulting in version 6.1 */ |
124 |
|
|
/* */ |
125 |
|
|
/**************************************************************************/ |
126 |
|
36 |
INT _gx_utility_math_acos(GX_FIXED_VAL x) |
127 |
|
|
{ |
128 |
|
36 |
INT angle = 0; |
129 |
|
|
|
130 |
|
36 |
angle = _gx_utility_math_asin(x); |
131 |
|
36 |
angle = 90 - angle; |
132 |
|
|
|
133 |
|
36 |
return angle; |
134 |
|
|
} |
135 |
|
|
|