Changeset 58775d30 in mainline for uspace/lib/math/generic/trig.c
- Timestamp:
- 2015-03-16T16:07:21Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2003739
- Parents:
- 6069061 (diff), 795e2bf (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/generic/trig.c
r6069061 r58775d30 39 39 40 40 /** Precomputed values for factorial (starting from 1!) */ 41 static doublefactorials[TAYLOR_DEGREE] = {41 static float64_t factorials[TAYLOR_DEGREE] = { 42 42 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 43 43 479001600, 6227020800 … … 56 56 * 57 57 */ 58 static double taylor_sin(doublearg)59 { 60 doubleret = 0;61 doublenom = 1;58 static float64_t taylor_sin(float64_t arg) 59 { 60 float64_t ret = 0; 61 float64_t nom = 1; 62 62 63 63 for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) { … … 85 85 * 86 86 */ 87 static double taylor_cos(doublearg)88 { 89 doubleret = 1;90 doublenom = 1;87 static float64_t taylor_cos(float64_t arg) 88 { 89 float64_t ret = 1; 90 float64_t nom = 1; 91 91 92 92 for (unsigned int i = 0; i < TAYLOR_DEGREE; i++) { … … 114 114 * 115 115 */ 116 static double base_sin(doublearg)116 static float64_t base_sin(float64_t arg) 117 117 { 118 118 unsigned int period = arg / (M_PI / 4); … … 147 147 * 148 148 */ 149 static double base_cos(doublearg)149 static float64_t base_cos(float64_t arg) 150 150 { 151 151 unsigned int period = arg / (M_PI / 4); … … 156 156 case 1: 157 157 case 2: 158 return taylor_sin(arg - M_PI / 2);158 return -taylor_sin(arg - M_PI / 2); 159 159 case 3: 160 160 case 4: … … 162 162 case 5: 163 163 case 6: 164 return -taylor_sin(arg - 3 * M_PI / 2);164 return taylor_sin(arg - 3 * M_PI / 2); 165 165 default: 166 166 return taylor_cos(arg - 2 * M_PI); … … 177 177 * 178 178 */ 179 double double_sin(doublearg)180 { 181 doublebase_arg = fmod(arg, 2 * M_PI);179 float64_t float64_sin(float64_t arg) 180 { 181 float64_t base_arg = fmod(arg, 2 * M_PI); 182 182 183 183 if (base_arg < 0) … … 196 196 * 197 197 */ 198 double double_cos(doublearg)199 { 200 doublebase_arg = fmod(arg, 2 * M_PI);198 float64_t float64_cos(float64_t arg) 199 { 200 float64_t base_arg = fmod(arg, 2 * M_PI); 201 201 202 202 if (base_arg < 0)
Note:
See TracChangeset
for help on using the changeset viewer.