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