Changeset 9adb61d in mainline
- Timestamp:
- 2015-09-05T11:50:00Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 996dc042, ba8eecf
- Parents:
- e6f5766
- Location:
- uspace/lib/math
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/math/arch/abs32le/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/amd64/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 43 44 #include <mod.h> 44 45 #include <pow.h> 46 #include <trunc.h> 47 #include <trig.h> 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 extern float64_t cos_f64(float64_t); 60 61 static inline float32_t cos_f32(float32_t val) 62 { 63 return (float32_t)cos_f64((float64_t)val); 64 } 65 66 static inline float64_t exp_f64(float64_t val) 67 { 68 return float64_exp(val); 69 } 70 71 static inline float32_t exp_f32(float32_t val) 72 { 73 return float32_exp(val); 74 } 75 76 static inline float64_t floor_f64(float64_t val) 77 { 78 return float64_floor(val); 79 } 80 81 static inline float32_t floor_f32(float32_t val) 82 { 83 return float32_floor(val); 84 } 85 86 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 87 { 88 return float64_mod(dividend, divisor); 89 } 90 91 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 92 { 93 return float32_mod(dividend, divisor); 94 } 95 96 static inline float64_t log_f64(float64_t val) 97 { 98 return float64_log(val); 99 } 100 101 static inline float32_t log_f32(float32_t val) 102 { 103 return float32_log(val); 104 } 105 106 static inline float64_t pow_f64(float64_t x, float64_t y) 107 { 108 return float64_pow(x, y); 109 } 110 111 static inline float32_t pow_f32(float32_t x, float32_t y) 112 { 113 return float32_pow(x, y); 114 } 115 116 extern float64_t sin_f64(float64_t); 117 118 static inline float32_t sin_f32(float32_t val) 119 { 120 return (float32_t)sin_f64((float64_t)val); 121 } 122 123 extern float64_t trunc_f64(float64_t); 124 125 static inline float32_t trunc_f32(float32_t val) 126 { 127 return (float32_t)trunc_f64((float64_t)val); 128 } 129 130 static inline float64_t ceil(float64_t val) 131 { 132 return ceil_f64(val); 133 } 134 135 static inline float32_t ceilf(float32_t val) 136 { 137 return ceil_f32(val); 138 } 139 140 static inline float64_t cos(float64_t val) 141 { 142 return cos_f64(val); 143 } 144 145 static inline float32_t cosf(float32_t val) 146 { 147 return cos_f32(val); 148 } 149 150 static inline float64_t exp(float64_t val) 151 { 152 return exp_f64(val); 153 } 154 155 static inline float32_t expf(float32_t val) 156 { 157 return exp_f32(val); 158 } 159 160 static inline float64_t floor(float64_t val) 161 { 162 return floor_f64(val); 163 } 164 165 static inline float32_t floorf(float32_t val) 166 { 167 return floor_f32(val); 168 } 45 169 46 170 static inline float64_t fmod(float64_t dividend, float64_t divisor) 47 171 { 48 return float64_mod(dividend, divisor); 49 } 50 51 extern float64_t sin(float64_t); 52 extern float64_t cos(float64_t); 53 54 static inline float64_t ceil(float64_t val) 55 { 56 return float64_ceil(val); 57 } 58 59 static inline float32_t expf(float32_t val) 60 { 61 return float32_exp(val); 62 } 63 64 static inline float64_t exp(float64_t val) 65 { 66 return float64_exp(val); 67 } 68 69 static inline float64_t floor(float64_t val) 70 { 71 return float64_floor(val); 172 return fmod_f64(dividend, divisor); 173 } 174 175 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 176 { 177 return fmod_f32(dividend, divisor); 178 } 179 180 static inline float64_t log(float64_t val) 181 { 182 return log_f64(val); 72 183 } 73 184 74 185 static inline float32_t logf(float32_t val) 75 186 { 76 return float32_log(val);77 } 78 79 static inline float64_t log(float64_t val)80 { 81 return float64_log(val);187 return log_f32(val); 188 } 189 190 static inline float64_t pow(float64_t x, float64_t y) 191 { 192 return pow_f64(x, y); 82 193 } 83 194 84 195 static inline float32_t powf(float32_t x, float32_t y) 85 196 { 86 return float32_pow(x, y); 87 } 88 89 static inline float64_t pow(float64_t x, float64_t y) 90 { 91 return float64_pow(x, y); 92 } 93 94 extern float64_t trunc(float64_t); 197 return pow_f32(x, y); 198 } 199 200 static inline float64_t sin(float64_t val) 201 { 202 return sin_f64(val); 203 } 204 205 static inline float32_t sinf(float32_t val) 206 { 207 return sin_f32(val); 208 } 209 210 static inline float64_t trunc(float64_t val) 211 { 212 return trunc_f64(val); 213 } 214 215 static inline float32_t truncf(float32_t val) 216 { 217 return trunc_f32(val); 218 } 95 219 96 220 #endif -
uspace/lib/math/arch/amd64/src/cos.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global cos 33 .global cos_f64 34 34 35 cos :35 cos_f64: 36 36 pushq %rbp 37 37 movq %rsp, %rbp -
uspace/lib/math/arch/amd64/src/sin.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global sin 33 .global sin_f64 34 34 35 sin :35 sin_f64: 36 36 pushq %rbp 37 37 movq %rsp, %rbp -
uspace/lib/math/arch/amd64/src/trunc.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global trunc 33 .global trunc_f64 34 34 35 trunc :35 trunc_f64: 36 36 pushq %rbp 37 37 movq %rsp, %rbp -
uspace/lib/math/arch/arm32/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/ia32/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 43 44 #include <mod.h> 44 45 #include <pow.h> 46 #include <trunc.h> 47 #include <trig.h> 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 extern float64_t cos_f64(float64_t); 60 61 static inline float32_t cos_f32(float32_t val) 62 { 63 return (float32_t)cos_f64((float64_t)val); 64 } 65 66 static inline float64_t exp_f64(float64_t val) 67 { 68 return float64_exp(val); 69 } 70 71 static inline float32_t exp_f32(float32_t val) 72 { 73 return float32_exp(val); 74 } 75 76 static inline float64_t floor_f64(float64_t val) 77 { 78 return float64_floor(val); 79 } 80 81 static inline float32_t floor_f32(float32_t val) 82 { 83 return float32_floor(val); 84 } 85 86 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 87 { 88 return float64_mod(dividend, divisor); 89 } 90 91 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 92 { 93 return float32_mod(dividend, divisor); 94 } 95 96 static inline float64_t log_f64(float64_t val) 97 { 98 return float64_log(val); 99 } 100 101 static inline float32_t log_f32(float32_t val) 102 { 103 return float32_log(val); 104 } 105 106 static inline float64_t pow_f64(float64_t x, float64_t y) 107 { 108 return float64_pow(x, y); 109 } 110 111 static inline float32_t pow_f32(float32_t x, float32_t y) 112 { 113 return float32_pow(x, y); 114 } 115 116 extern float64_t sin_f64(float64_t); 117 118 static inline float32_t sin_f32(float32_t val) 119 { 120 return (float32_t)sin_f64((float64_t)val); 121 } 122 123 extern float64_t trunc_f64(float64_t); 124 125 static inline float32_t trunc_f32(float32_t val) 126 { 127 return (float32_t)trunc_f64((float64_t)val); 128 } 129 130 static inline float64_t ceil(float64_t val) 131 { 132 return ceil_f64(val); 133 } 134 135 static inline float32_t ceilf(float32_t val) 136 { 137 return ceil_f32(val); 138 } 139 140 static inline float64_t cos(float64_t val) 141 { 142 return cos_f64(val); 143 } 144 145 static inline float32_t cosf(float32_t val) 146 { 147 return cos_f32(val); 148 } 149 150 static inline float64_t exp(float64_t val) 151 { 152 return exp_f64(val); 153 } 154 155 static inline float32_t expf(float32_t val) 156 { 157 return exp_f32(val); 158 } 159 160 static inline float64_t floor(float64_t val) 161 { 162 return floor_f64(val); 163 } 164 165 static inline float32_t floorf(float32_t val) 166 { 167 return floor_f32(val); 168 } 45 169 46 170 static inline float64_t fmod(float64_t dividend, float64_t divisor) 47 171 { 48 return float64_mod(dividend, divisor); 49 } 50 51 extern float64_t sin(float64_t); 52 extern float64_t cos(float64_t); 53 54 static inline float64_t ceil(float64_t val) 55 { 56 return float64_ceil(val); 57 } 58 59 static inline float64_t floor(float64_t val) 60 { 61 return float64_floor(val); 62 } 63 64 static inline float32_t expf(float32_t val) 65 { 66 return float32_exp(val); 67 } 68 69 static inline float64_t exp(float64_t val) 70 { 71 return float64_exp(val); 172 return fmod_f64(dividend, divisor); 173 } 174 175 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 176 { 177 return fmod_f32(dividend, divisor); 178 } 179 180 static inline float64_t log(float64_t val) 181 { 182 return log_f64(val); 72 183 } 73 184 74 185 static inline float32_t logf(float32_t val) 75 186 { 76 return float32_log(val);77 } 78 79 static inline float64_t log(float64_t val)80 { 81 return float64_log(val);187 return log_f32(val); 188 } 189 190 static inline float64_t pow(float64_t x, float64_t y) 191 { 192 return pow_f64(x, y); 82 193 } 83 194 84 195 static inline float32_t powf(float32_t x, float32_t y) 85 196 { 86 return float32_pow(x, y); 87 } 88 89 static inline float64_t pow(float64_t x, float64_t y) 90 { 91 return float64_pow(x, y); 92 } 93 94 extern float64_t trunc(float64_t); 197 return pow_f32(x, y); 198 } 199 200 static inline float64_t sin(float64_t val) 201 { 202 return sin_f64(val); 203 } 204 205 static inline float32_t sinf(float32_t val) 206 { 207 return sin_f32(val); 208 } 209 210 static inline float64_t trunc(float64_t val) 211 { 212 return trunc_f64(val); 213 } 214 215 static inline float32_t truncf(float32_t val) 216 { 217 return trunc_f32(val); 218 } 95 219 96 220 #endif -
uspace/lib/math/arch/ia32/src/cos.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global cos 33 .global cos_f64 34 34 35 cos :35 cos_f64: 36 36 # compute cosine (no stack frame) 37 37 -
uspace/lib/math/arch/ia32/src/sin.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global sin 33 .global sin_f64 34 34 35 sin :35 sin_f64: 36 36 # compute sine (no stack frame) 37 37 -
uspace/lib/math/arch/ia32/src/trunc.S
re6f5766 r9adb61d 31 31 .text 32 32 33 .global trunc 33 .global trunc_f64 34 34 35 trunc :35 trunc_f64: 36 36 pushl %ebp 37 37 movl %esp, %ebp -
uspace/lib/math/arch/ia64/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 40 41 #include <floor.h> 41 42 #include <log.h> 42 #include <pow.h>43 43 #include <mathtypes.h> 44 44 #include <mod.h> 45 #include <pow.h> 45 46 #include <trunc.h> 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/mips32/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/mips32eb/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/ppc32/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 51 } 52 53 static inline double trunc(double val) 54 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 76 192 } 77 193 78 194 static inline float32_t logf(float32_t val) 79 195 { 80 return float32_log(val);81 } 82 83 static inline float64_t log(float64_t val)84 { 85 return float64_log(val);196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 86 202 } 87 203 88 204 static inline float32_t powf(float32_t x, float32_t y) 89 205 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 206 return pow_f32(x, y); 207 } 98 208 99 209 static inline float64_t sin(float64_t val) 100 210 { 101 return float64_sin(val); 102 } 103 104 static inline float64_t cos(float64_t val) 105 { 106 return float64_cos(val); 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 217 } 218 219 static inline float64_t trunc(float64_t val) 220 { 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 107 227 } 108 228 -
uspace/lib/math/arch/sparc32/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 static inline float64_t sin(float64_t val) 99 { 100 return float64_sin(val); 101 } 102 103 static inline float64_t cos(float64_t val) 104 { 105 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 106 227 } 107 228 -
uspace/lib/math/arch/sparc64/include/libarch/math.h
re6f5766 r9adb61d 1 1 /* 2 2 * Copyright (c) 2014 Martin Decky 3 * Copyright (c) 2015 Jiri Svoboda 3 4 * All rights reserved. 4 5 * … … 46 47 #include <trig.h> 47 48 49 static inline float64_t ceil_f64(float64_t val) 50 { 51 return float64_ceil(val); 52 } 53 54 static inline float32_t ceil_f32(float32_t val) 55 { 56 return float32_ceil(val); 57 } 58 59 static inline float64_t cos_f64(float64_t val) 60 { 61 return float64_cos(val); 62 } 63 64 static inline float32_t cos_f32(float32_t val) 65 { 66 return float32_cos(val); 67 } 68 69 static inline float64_t exp_f64(float64_t val) 70 { 71 return float64_exp(val); 72 } 73 74 static inline float32_t exp_f32(float32_t val) 75 { 76 return float32_exp(val); 77 } 78 79 static inline float64_t floor_f64(float64_t val) 80 { 81 return float64_floor(val); 82 } 83 84 static inline float32_t floor_f32(float32_t val) 85 { 86 return float32_floor(val); 87 } 88 89 static inline float64_t fmod_f64(float64_t dividend, float64_t divisor) 90 { 91 return float64_mod(dividend, divisor); 92 } 93 94 static inline float64_t fmod_f32(float32_t dividend, float32_t divisor) 95 { 96 return float32_mod(dividend, divisor); 97 } 98 99 static inline float64_t log_f64(float64_t val) 100 { 101 return float64_log(val); 102 } 103 104 static inline float32_t log_f32(float32_t val) 105 { 106 return float32_log(val); 107 } 108 109 static inline float64_t pow_f64(float64_t x, float64_t y) 110 { 111 return float64_pow(x, y); 112 } 113 114 static inline float32_t pow_f32(float32_t x, float32_t y) 115 { 116 return float32_pow(x, y); 117 } 118 119 static inline float64_t sin_f64(float64_t val) 120 { 121 return float64_sin(val); 122 } 123 124 static inline float32_t sin_f32(float32_t val) 125 { 126 return float32_sin(val); 127 } 128 129 static inline float64_t trunc_f64(float64_t val) 130 { 131 return float64_trunc(val); 132 } 133 134 static inline float32_t trunc_f32(float32_t val) 135 { 136 return float32_trunc(val); 137 } 138 139 static inline float64_t ceil(float64_t val) 140 { 141 return ceil_f64(val); 142 } 143 144 static inline float32_t ceilf(float32_t val) 145 { 146 return ceil_f32(val); 147 } 148 149 static inline float64_t cos(float64_t val) 150 { 151 return cos_f64(val); 152 } 153 154 static inline float32_t cosf(float32_t val) 155 { 156 return cos_f32(val); 157 } 158 159 static inline float64_t exp(float64_t val) 160 { 161 return exp_f64(val); 162 } 163 164 static inline float32_t expf(float32_t val) 165 { 166 return exp_f32(val); 167 } 168 169 static inline float64_t floor(float64_t val) 170 { 171 return floor_f64(val); 172 } 173 174 static inline float32_t floorf(float32_t val) 175 { 176 return floor_f32(val); 177 } 178 48 179 static inline float64_t fmod(float64_t dividend, float64_t divisor) 49 180 { 50 return float64_mod(dividend, divisor); 181 return fmod_f64(dividend, divisor); 182 } 183 184 static inline float32_t fmodf(float32_t dividend, float32_t divisor) 185 { 186 return fmod_f32(dividend, divisor); 187 } 188 189 static inline float64_t log(float64_t val) 190 { 191 return log_f64(val); 192 } 193 194 static inline float32_t logf(float32_t val) 195 { 196 return log_f32(val); 197 } 198 199 static inline float64_t pow(float64_t x, float64_t y) 200 { 201 return pow_f64(x, y); 202 } 203 204 static inline float32_t powf(float32_t x, float32_t y) 205 { 206 return pow_f32(x, y); 207 } 208 209 static inline float64_t sin(float64_t val) 210 { 211 return sin_f64(val); 212 } 213 214 static inline float32_t sinf(float32_t val) 215 { 216 return sin_f32(val); 51 217 } 52 218 53 219 static inline float64_t trunc(float64_t val) 54 220 { 55 return float64_trunc(val); 56 } 57 58 static inline float64_t ceil(float64_t val) 59 { 60 return float64_ceil(val); 61 } 62 63 static inline float32_t expf(float32_t val) 64 { 65 return float32_exp(val); 66 } 67 68 static inline float64_t exp(float64_t val) 69 { 70 return float64_exp(val); 71 } 72 73 static inline float64_t floor(float64_t val) 74 { 75 return float64_floor(val); 76 } 77 78 static inline float32_t logf(float32_t val) 79 { 80 return float32_log(val); 81 } 82 83 static inline float64_t log(float64_t val) 84 { 85 return float64_log(val); 86 } 87 88 static inline float32_t powf(float32_t x, float32_t y) 89 { 90 return float32_pow(x, y); 91 } 92 93 static inline float64_t pow(float64_t x, float64_t y) 94 { 95 return float64_pow(x, y); 96 } 97 98 99 static inline float64_t sin(float64_t val) 100 { 101 return float64_sin(val); 102 } 103 104 static inline float64_t cos(float64_t val) 105 { 106 return float64_cos(val); 221 return trunc_f64(val); 222 } 223 224 static inline float32_t truncf(float32_t val) 225 { 226 return trunc_f32(val); 107 227 } 108 228 -
uspace/lib/math/generic/ceil.c
re6f5766 r9adb61d 34 34 35 35 #include <ceil.h> 36 #include <math.h> 36 37 #include <mathtypes.h> 37 #include <trunc.h>38 38 39 /** Ceiling (round towards positive infinity) 39 /** Ceiling (round towards positive infinity, 32-bit floating point) 40 * 41 * @param val Floating point number. 42 * 43 * @return Number rounded towards positive infinity. 44 */ 45 float32_t float32_ceil(float32_t val) 46 { 47 float32_u t; 48 float32_u v; 49 float32_u r; 50 51 v.val = val; 52 t.val = trunc_f32(val); 53 54 if (v.data.parts.sign == 1 || val == t.val) { 55 r = t; 56 } else { 57 r.val = t.val + 1.0; 58 } 59 60 return r.val; 61 } 62 63 /** Ceiling (round towards positive infinity, 64-bit floating point) 40 64 * 41 65 * @param val Floating point number. … … 50 74 51 75 v.val = val; 52 t.val = float64_trunc(val);76 t.val = trunc_f64(val); 53 77 54 78 if (v.data.parts.sign == 1 || val == t.val) { -
uspace/lib/math/generic/exp.c
re6f5766 r9adb61d 49 49 }; 50 50 51 /** Exponential approximation by Taylor series (32- ))51 /** Exponential approximation by Taylor series (32-bit floating point) 52 52 * 53 53 * Compute the approximation of exponential by a Taylor … … 61 61 * 62 62 */ 63 static float 64_t taylor_exp_32(float64_t arg)63 static float32_t taylor_exp_32(float32_t arg) 64 64 { 65 float 64_t ret = 1;66 float 64_t nom = 1;65 float32_t ret = 1; 66 float32_t nom = 1; 67 67 68 68 for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) { … … 74 74 } 75 75 76 /** Exponential approximation by Taylor series 76 /** Exponential approximation by Taylor series (64-bit floating point) 77 77 * 78 78 * Compute the approximation of exponential by a Taylor … … 99 99 } 100 100 101 /** Single precision exponential101 /** Exponential (32-bit floating point) 102 102 * 103 103 * Compute exponential value. … … 121 121 */ 122 122 123 i = float32_trunc(arg * M_LOG2E);123 i = trunc_f32(arg * M_LOG2E); 124 124 f = arg * M_LOG2E - i; 125 125 … … 129 129 } 130 130 131 /** Double precision exponential131 /** Exponential (64-bit floating point) 132 132 * 133 133 * Compute exponential value. … … 151 151 */ 152 152 153 i = float64_trunc(arg * M_LOG2E);153 i = trunc_f64(arg * M_LOG2E); 154 154 f = arg * M_LOG2E - i; 155 155 -
uspace/lib/math/generic/floor.c
re6f5766 r9adb61d 34 34 35 35 #include <floor.h> 36 #include <math.h> 36 37 #include <mathtypes.h> 37 #include <trunc.h>38 38 39 /** Ceiling (round towards negative infinity) 39 /** Ceiling (round towards negative infinity, 32-bit floating point) 40 * 41 * @param val Floating point number. 42 * 43 * @return Number rounded towards negative infinity. 44 */ 45 46 float32_t float32_floor(float32_t val) 47 { 48 float32_t t; 49 float32_u v; 50 51 v.val = val; 52 t = trunc_f32(val); 53 54 if (v.data.parts.sign == 0 || val == t) 55 return t; 56 else 57 return t - 1.0; 58 } 59 60 /** Ceiling (round towards negative infinity, 64-bit floating point) 40 61 * 41 62 * @param val Floating point number. … … 50 71 51 72 v.val = val; 52 t = float64_trunc(val);73 t = trunc_f64(val); 53 74 54 75 if (v.data.parts.sign == 0 || val == t) -
uspace/lib/math/generic/log.c
re6f5766 r9adb61d 40 40 #define TAYLOR_DEGREE_64 63 41 41 42 /** Single precision log(1 - arg) approximation by Taylor series42 /** log(1 - arg) approximation by Taylor series (32-bit floating point) 43 43 * 44 44 * Compute the approximation of log(1 - arg) by a Taylor … … 68 68 } 69 69 70 /** Double precision log(1 - arg) approximation by Taylor series70 /** log(1 - arg) approximation by Taylor series (64-bit floating point) 71 71 * 72 72 * Compute the approximation of log(1 - arg) by a Taylor … … 96 96 } 97 97 98 /** Single precision logarithm98 /** Natural logarithm (32-bit floating point) 99 99 * 100 100 * @param arg Argument. … … 126 126 } 127 127 128 /** Double precision logarithm128 /** Natural logarithm (64-bit floating point) 129 129 * 130 130 * @param arg Argument. -
uspace/lib/math/generic/mod.c
re6f5766 r9adb61d 36 36 #include <mod.h> 37 37 38 /** Double precision modulo 38 /** Remainder function (32-bit floating point) 39 * 40 * Calculate the modulo of dividend by divisor. 41 * 42 * This is a very basic implementation that uses 43 * division and multiplication (instead of exact 44 * arithmetics). Thus the result might be very 45 * imprecise (depending on the magnitude of the 46 * arguments). 47 * 48 * @param dividend Dividend. 49 * @param divisor Divisor. 50 * 51 * @return Modulo. 52 * 53 */ 54 float32_t float32_mod(float32_t dividend, float32_t divisor) 55 { 56 // FIXME: replace with exact arithmetics 57 58 float32_t quotient = trunc_f32(dividend / divisor); 59 60 return (dividend - quotient * divisor); 61 } 62 63 /** Remainder function (64-bit floating point) 39 64 * 40 65 * Calculate the modulo of dividend by divisor. … … 56 81 // FIXME: replace with exact arithmetics 57 82 58 float64_t quotient = trunc (dividend / divisor);83 float64_t quotient = trunc_f64(dividend / divisor); 59 84 60 85 return (dividend - quotient * divisor); -
uspace/lib/math/generic/pow.c
re6f5766 r9adb61d 52 52 { 53 53 /* x^y = (e ^ log(x))^y = e ^ (log(x) * y) */ 54 return float32_exp(float32_log(x) * y);54 return exp_f32(log_f32(x) * y); 55 55 } 56 56 … … 68 68 { 69 69 /* x^y = (e ^ log(x))^y = e ^ (log(x) * y) */ 70 return float64_exp(float64_log(x) * y);70 return exp_f64(log_f64(x) * y); 71 71 } 72 72 -
uspace/lib/math/generic/trig.c
re6f5766 r9adb61d 1 1 /* 2 * Copyright (c) 2015 Jiri Svoboda 2 3 * Copyright (c) 2014 Martin Decky 3 4 * All rights reserved. … … 47 48 }; 48 49 49 /** Sine approximation by Taylor series 50 /** Sine approximation by Taylor series (32-bit floating point) 50 51 * 51 52 * Compute the approximation of sine by a Taylor … … 59 60 * 60 61 */ 61 static float64_t taylor_sin(float64_t arg) 62 static float32_t taylor_sin_32(float32_t arg) 63 { 64 float32_t ret = 0; 65 float32_t nom = 1; 66 67 for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) { 68 nom *= arg; 69 70 if ((i % 4) == 0) 71 ret += nom / factorials[i]; 72 else if ((i % 4) == 2) 73 ret -= nom / factorials[i]; 74 } 75 76 return ret; 77 } 78 79 /** Sine approximation by Taylor series (64-bit floating point) 80 * 81 * Compute the approximation of sine by a Taylor 82 * series (using the first TAYLOR_DEGREE terms). 83 * The approximation is reasonably accurate for 84 * arguments within the interval [-pi/4, pi/4]. 85 * 86 * @param arg Sine argument. 87 * 88 * @return Sine value approximation. 89 * 90 */ 91 static float64_t taylor_sin_64(float64_t arg) 62 92 { 63 93 float64_t ret = 0; … … 76 106 } 77 107 78 /** Cosine approximation by Taylor series 108 /** Cosine approximation by Taylor series (32-bit floating point) 79 109 * 80 110 * Compute the approximation of cosine by a Taylor … … 88 118 * 89 119 */ 90 static float64_t taylor_cos(float64_t arg) 120 static float32_t taylor_cos_32(float32_t arg) 121 { 122 float32_t ret = 1; 123 float32_t nom = 1; 124 125 for (unsigned int i = 0; i < TAYLOR_DEGREE_32; i++) { 126 nom *= arg; 127 128 if ((i % 4) == 1) 129 ret -= nom / factorials[i]; 130 else if ((i % 4) == 3) 131 ret += nom / factorials[i]; 132 } 133 134 return ret; 135 } 136 137 /** Cosine approximation by Taylor series (64-bit floating point) 138 * 139 * Compute the approximation of cosine by a Taylor 140 * series (using the first TAYLOR_DEGREE terms). 141 * The approximation is reasonably accurate for 142 * arguments within the interval [-pi/4, pi/4]. 143 * 144 * @param arg Cosine argument. 145 * 146 * @return Cosine value approximation. 147 * 148 */ 149 static float64_t taylor_cos_64(float64_t arg) 91 150 { 92 151 float64_t ret = 1; … … 105 164 } 106 165 107 /** Sine value for values within base period 166 /** Sine value for values within base period (32-bit floating point) 108 167 * 109 168 * Compute the value of sine for arguments within … … 117 176 * 118 177 */ 119 static float 64_t base_sin(float64_t arg)178 static float32_t base_sin_32(float32_t arg) 120 179 { 121 180 unsigned int period = arg / (M_PI / 4); … … 123 182 switch (period) { 124 183 case 0: 125 return taylor_sin (arg);184 return taylor_sin_32(arg); 126 185 case 1: 127 186 case 2: 128 return taylor_cos (arg - M_PI / 2);187 return taylor_cos_32(arg - M_PI / 2); 129 188 case 3: 130 189 case 4: 131 return -taylor_sin (arg - M_PI);190 return -taylor_sin_32(arg - M_PI); 132 191 case 5: 133 192 case 6: 134 return -taylor_cos (arg - 3 * M_PI / 2);193 return -taylor_cos_32(arg - 3 * M_PI / 2); 135 194 default: 136 return taylor_sin(arg - 2 * M_PI); 137 } 138 } 139 140 /** Cosine value for values within base period 195 return taylor_sin_32(arg - 2 * M_PI); 196 } 197 } 198 199 /** Sine value for values within base period (64-bit floating point) 200 * 201 * Compute the value of sine for arguments within 202 * the base period [0, 2pi]. For arguments outside 203 * the base period the returned values can be 204 * very inaccurate or even completely wrong. 205 * 206 * @param arg Sine argument. 207 * 208 * @return Sine value. 209 * 210 */ 211 static float64_t base_sin_64(float64_t arg) 212 { 213 unsigned int period = arg / (M_PI / 4); 214 215 switch (period) { 216 case 0: 217 return taylor_sin_64(arg); 218 case 1: 219 case 2: 220 return taylor_cos_64(arg - M_PI / 2); 221 case 3: 222 case 4: 223 return -taylor_sin_64(arg - M_PI); 224 case 5: 225 case 6: 226 return -taylor_cos_64(arg - 3 * M_PI / 2); 227 default: 228 return taylor_sin_64(arg - 2 * M_PI); 229 } 230 } 231 232 /** Cosine value for values within base period (32-bit floating point) 141 233 * 142 234 * Compute the value of cosine for arguments within … … 150 242 * 151 243 */ 152 static float 64_t base_cos(float64_t arg)244 static float32_t base_cos_32(float32_t arg) 153 245 { 154 246 unsigned int period = arg / (M_PI / 4); … … 156 248 switch (period) { 157 249 case 0: 158 return taylor_cos (arg);250 return taylor_cos_32(arg); 159 251 case 1: 160 252 case 2: 161 return -taylor_sin (arg - M_PI / 2);253 return -taylor_sin_32(arg - M_PI / 2); 162 254 case 3: 163 255 case 4: 164 return -taylor_cos (arg - M_PI);256 return -taylor_cos_32(arg - M_PI); 165 257 case 5: 166 258 case 6: 167 return taylor_sin (arg - 3 * M_PI / 2);259 return taylor_sin_32(arg - 3 * M_PI / 2); 168 260 default: 169 return taylor_cos(arg - 2 * M_PI); 170 } 171 } 172 173 /** Double precision sine 261 return taylor_cos_32(arg - 2 * M_PI); 262 } 263 } 264 265 /** Cosine value for values within base period (64-bit floating point) 266 * 267 * Compute the value of cosine for arguments within 268 * the base period [0, 2pi]. For arguments outside 269 * the base period the returned values can be 270 * very inaccurate or even completely wrong. 271 * 272 * @param arg Cosine argument. 273 * 274 * @return Cosine value. 275 * 276 */ 277 static float64_t base_cos_64(float64_t arg) 278 { 279 unsigned int period = arg / (M_PI / 4); 280 281 switch (period) { 282 case 0: 283 return taylor_cos_64(arg); 284 case 1: 285 case 2: 286 return -taylor_sin_64(arg - M_PI / 2); 287 case 3: 288 case 4: 289 return -taylor_cos_64(arg - M_PI); 290 case 5: 291 case 6: 292 return taylor_sin_64(arg - 3 * M_PI / 2); 293 default: 294 return taylor_cos_64(arg - 2 * M_PI); 295 } 296 } 297 298 /** Sine (32-bit floating point) 174 299 * 175 300 * Compute sine value. … … 180 305 * 181 306 */ 307 float32_t float32_sin(float32_t arg) 308 { 309 float32_t base_arg = fmod_f32(arg, 2 * M_PI); 310 311 if (base_arg < 0) 312 return -base_sin_32(-base_arg); 313 314 return base_sin_32(base_arg); 315 } 316 317 /** Sine (64-bit floating point) 318 * 319 * Compute sine value. 320 * 321 * @param arg Sine argument. 322 * 323 * @return Sine value. 324 * 325 */ 182 326 float64_t float64_sin(float64_t arg) 183 327 { 184 float64_t base_arg = fmod (arg, 2 * M_PI);328 float64_t base_arg = fmod_f64(arg, 2 * M_PI); 185 329 186 330 if (base_arg < 0) 187 return -base_sin (-base_arg);188 189 return base_sin (base_arg);190 } 191 192 /** Double precision cosine331 return -base_sin_64(-base_arg); 332 333 return base_sin_64(base_arg); 334 } 335 336 /** Cosine (32-bit floating point) 193 337 * 194 338 * Compute cosine value. … … 199 343 * 200 344 */ 345 float32_t float32_cos(float32_t arg) 346 { 347 float32_t base_arg = fmod_f32(arg, 2 * M_PI); 348 349 if (base_arg < 0) 350 return base_cos_32(-base_arg); 351 352 return base_cos_32(base_arg); 353 } 354 355 /** Cosine (64-bit floating point) 356 * 357 * Compute cosine value. 358 * 359 * @param arg Cosine argument. 360 * 361 * @return Cosine value. 362 * 363 */ 201 364 float64_t float64_cos(float64_t arg) 202 365 { 203 float64_t base_arg = fmod (arg, 2 * M_PI);366 float64_t base_arg = fmod_f64(arg, 2 * M_PI); 204 367 205 368 if (base_arg < 0) 206 return base_cos (-base_arg);207 208 return base_cos (base_arg);369 return base_cos_64(-base_arg); 370 371 return base_cos_64(base_arg); 209 372 } 210 373 -
uspace/lib/math/generic/trunc.c
re6f5766 r9adb61d 1 1 /* 2 * Copyright (c) 2015 Jiri Svoboda 2 3 * Copyright (c) 2014 Martin Decky 3 4 * All rights reserved. -
uspace/lib/math/include/ceil.h
re6f5766 r9adb61d 38 38 #include <mathtypes.h> 39 39 40 extern float32_t float32_ceil(float32_t); 40 41 extern float64_t float64_ceil(float64_t); 41 42 -
uspace/lib/math/include/floor.h
re6f5766 r9adb61d 38 38 #include <mathtypes.h> 39 39 40 extern float32_t float32_floor(float32_t); 40 41 extern float64_t float64_floor(float64_t); 41 42 -
uspace/lib/math/include/mod.h
re6f5766 r9adb61d 36 36 #define LIBMATH_MOD_H_ 37 37 38 extern float32_t float32_mod(float32_t, float32_t); 38 39 extern float64_t float64_mod(float64_t, float64_t); 39 40 -
uspace/lib/math/include/trig.h
re6f5766 r9adb61d 38 38 #include <mathtypes.h> 39 39 40 extern float32_t float32_sin(float32_t); 40 41 extern float64_t float64_sin(float64_t); 42 extern float32_t float32_cos(float32_t); 41 43 extern float64_t float64_cos(float64_t); 42 44
Note:
See TracChangeset
for help on using the changeset viewer.