Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1 | # |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 2 | # Copyright (C) 2014 The Android Open Source Project |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | |
| 17 | start: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 18 | w: 1, 2, 3, 4 |
| 19 | t: i8, i16, i32 |
| 20 | name: abs |
| 21 | ret: u#2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 22 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 23 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 24 | Returns the absolute value of an integer. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 25 | |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 26 | For floats, use fabs(). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 27 | version: 9 |
| 28 | end: |
| 29 | |
| 30 | start: |
| 31 | w: 1, 2, 3, 4 |
| 32 | t: f32 |
| 33 | name: acos |
| 34 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 35 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 36 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 37 | Returns the inverse cosine, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 38 | version: 9 |
| 39 | end: |
| 40 | |
| 41 | start: |
| 42 | w: 1, 2, 3, 4 |
| 43 | t: f32 |
| 44 | name: acosh |
| 45 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 46 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 47 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 48 | Returns the inverse hyperbolic cosine, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 49 | version: 9 |
| 50 | end: |
| 51 | |
| 52 | start: |
| 53 | w: 1, 2, 3, 4 |
| 54 | t: f32 |
| 55 | name: acospi |
| 56 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 57 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 58 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 59 | Returns the inverse cosine in radians, divided by pi. |
| 60 | |
| 61 | To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 62 | version: 9 |
| 63 | end: |
| 64 | |
| 65 | start: |
| 66 | w: 1, 2, 3, 4 |
| 67 | t: f32 |
| 68 | name: asin |
| 69 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 70 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 71 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 72 | Returns the inverse sine, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 73 | version: 9 |
| 74 | end: |
| 75 | |
| 76 | start: |
| 77 | w: 1, 2, 3, 4 |
| 78 | t: f32 |
| 79 | name: asinh |
| 80 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 81 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 82 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 83 | Returns the inverse hyperbolic sine, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 84 | version: 9 |
| 85 | end: |
| 86 | |
| 87 | start: |
| 88 | w: 1, 2, 3, 4 |
| 89 | t: f32 |
| 90 | name: asinpi |
| 91 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 92 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 93 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 94 | Returns the inverse sine in radians, divided by pi. |
| 95 | |
| 96 | To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 97 | version: 9 |
| 98 | end: |
| 99 | |
| 100 | start: |
| 101 | w: 1, 2, 3, 4 |
| 102 | t: f32 |
| 103 | name: atan |
| 104 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 105 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 106 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 107 | Returns the inverse tangent, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 108 | version: 9 |
| 109 | end: |
| 110 | |
| 111 | start: |
| 112 | w: 1, 2, 3, 4 |
| 113 | t: f32 |
| 114 | name: atan2 |
| 115 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 116 | arg: #2#1 numerator |
| 117 | arg: #2#1 denominator |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 118 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 119 | Returns the inverse tangent of (numerator / denominator), in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 120 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 121 | denominator can be 0. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 122 | version: 9 |
| 123 | end: |
| 124 | |
| 125 | start: |
| 126 | w: 1, 2, 3, 4 |
| 127 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 128 | name: atan2pi |
| 129 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 130 | arg: #2#1 numerator |
| 131 | arg: #2#1 denominator |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 132 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 133 | Returns the inverse tangent of (numerator / denominator), in radians, divided by pi. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 134 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 135 | To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 136 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 137 | denominator can be 0. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 138 | version: 9 |
| 139 | end: |
| 140 | |
| 141 | start: |
| 142 | w: 1, 2, 3, 4 |
| 143 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 144 | name: atanh |
| 145 | ret: #2#1 |
Jean-Luc Brouillet | 32c1818 | 2014-07-29 13:52:45 -0700 | [diff] [blame] | 146 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 147 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 148 | Returns the inverse hyperbolic tangent, in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 149 | version: 9 |
| 150 | end: |
| 151 | |
| 152 | start: |
| 153 | w: 1, 2, 3, 4 |
| 154 | t: f32 |
| 155 | name: atanpi |
| 156 | ret: #2#1 |
Jean-Luc Brouillet | bcd5b9a | 2014-03-07 18:00:57 -0800 | [diff] [blame] | 157 | arg: #2#1 v range(-1,1) |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 158 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 159 | Returns the inverse tangent in radians, divided by pi. |
| 160 | |
| 161 | To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 162 | version: 9 |
| 163 | end: |
| 164 | |
| 165 | start: |
| 166 | w: 1, 2, 3, 4 |
| 167 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 168 | name: cbrt |
| 169 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 170 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 171 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 172 | Returns the cube root. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 173 | version: 9 |
| 174 | end: |
| 175 | |
| 176 | start: |
| 177 | w: 1, 2, 3, 4 |
| 178 | t: f32 |
| 179 | name: ceil |
| 180 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 181 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 182 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 183 | Returns the smallest integer not less than a value. |
| 184 | |
| 185 | For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 186 | version: 9 |
| 187 | end: |
| 188 | |
| 189 | start: |
| 190 | w: 1, 2, 3, 4 |
| 191 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 192 | name: clamp |
| 193 | ret: #2#1 |
| 194 | arg: #2#1 value |
| 195 | arg: #2#1 min_value |
| 196 | arg: #2#1 max_value above(min_value) |
| 197 | comment: |
| 198 | Clamps a value to a specified high and low bound. |
| 199 | |
| 200 | clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value. |
| 201 | |
| 202 | If min_value is greater than max_value, the results are undefined. |
| 203 | |
| 204 | @param value Value to be clamped. Supports 1, 2, 3, 4 components. |
| 205 | @param min_value Lower bound, must be scalar or matching vector. |
| 206 | @param max_value High bound, must match the type of low. |
| 207 | version: 9 |
| 208 | end: |
| 209 | |
| 210 | start: |
| 211 | w: 2, 3, 4 |
| 212 | t: f32 |
| 213 | name: clamp |
| 214 | ret: #2#1 |
| 215 | arg: #2#1 value |
| 216 | arg: #2 min_value |
| 217 | arg: #2 max_value above(min_value) |
| 218 | comment: |
| 219 | Clamps a value to a specified high and low bound. |
| 220 | |
| 221 | clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value. |
| 222 | |
| 223 | If min_value is greater than max_value, the results are undefined. |
| 224 | |
| 225 | @param value Value to be clamped. Supports 1, 2, 3, 4 components. |
| 226 | @param min_value Lower bound, must be scalar or matching vector. |
| 227 | @param max_value High bound, must match the type of low. |
| 228 | version: 9 |
| 229 | end: |
| 230 | |
| 231 | start: |
| 232 | w: 1, 2, 3, 4 |
| 233 | t: u8, u16, u32, u64, i8, i16, i32, i64 |
| 234 | name: clamp |
| 235 | ret: #2#1 |
| 236 | arg: #2#1 value |
| 237 | arg: #2#1 min_value |
| 238 | arg: #2#1 max_value above(min_value) |
| 239 | comment: |
| 240 | Clamps a value to a specified high and low bound. |
| 241 | |
| 242 | clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value. |
| 243 | |
| 244 | If min_value is greater than max_value, the results are undefined. |
| 245 | |
| 246 | @param value Value to be clamped. Supports 1, 2, 3, 4 components. |
| 247 | @param min_value Lower bound, must be scalar or matching vector. |
| 248 | @param max_value High bound, must match the type of low. |
| 249 | version: 19 |
| 250 | end: |
| 251 | |
| 252 | start: |
| 253 | w: 2, 3, 4 |
| 254 | t: u8, u16, u32, u64, i8, i16, i32, i64 |
| 255 | name: clamp |
| 256 | ret: #2#1 |
| 257 | arg: #2#1 value |
| 258 | arg: #2 min_value |
| 259 | arg: #2 max_value above(min_value) |
| 260 | comment: |
| 261 | Clamps a value to a specified high and low bound. |
| 262 | |
| 263 | clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value. |
| 264 | |
| 265 | If min_value is greater than max_value, the results are undefined. |
| 266 | |
| 267 | @param value Value to be clamped. Supports 1, 2, 3, 4 components. |
| 268 | @param min_value Lower bound, must be scalar or matching vector. |
| 269 | @param max_value High bound, must match the type of low. |
| 270 | version: 19 |
| 271 | end: |
| 272 | |
| 273 | start: |
| 274 | w: 1, 2, 3, 4 |
| 275 | t: u8, u16, u32, i8, i16, i32 |
| 276 | name: clz |
| 277 | ret: #2#1 |
| 278 | arg: #2#1 value |
| 279 | comment: |
| 280 | Returns the number of leading 0-bits in a value. |
| 281 | |
| 282 | For example, clz((char)0x03) returns 5. |
| 283 | version: 9 |
| 284 | end: |
| 285 | |
| 286 | start: |
| 287 | w: 2, 3, 4 |
| 288 | t: u8, u16, u32, i8, i16, i32, f32 |
| 289 | t: u8, u16, u32, i8, i16, i32, f32 |
| 290 | name: convert_#3#1 |
| 291 | arg: #2#1 v compatible(#3) |
| 292 | ret: #3#1 |
| 293 | comment: |
| 294 | Component wise conversion from #2#1 to #3#1. |
| 295 | |
| 296 | For the convert_* functions, conversions of floating point values to integer will truncate. |
| 297 | Conversions of numbers too large to fit the destination type yield undefined results. |
| 298 | For example, converting a float that contains 1.0e18 to a short is undefined. |
| 299 | version: 9 |
| 300 | end: |
| 301 | |
| 302 | start: |
| 303 | w: 2, 3, 4 |
| 304 | t: u64, i64, f64 |
| 305 | t: u64, i64, f64 |
| 306 | name: convert_#3#1 |
| 307 | arg: #2#1 v compatible(#3) |
| 308 | ret: #3#1 |
| 309 | comment: |
| 310 | Component wise conversion from #2#1 to #3#1. |
| 311 | |
| 312 | For the convert_* functions, conversions of floating point values to integer will truncate. |
| 313 | Conversions of numbers too large to fit the destination type yield undefined results. |
| 314 | For example, converting a float that contains 1.0e18 to a short is undefined. |
| 315 | version: 21 |
| 316 | end: |
| 317 | |
| 318 | start: |
| 319 | w: 2, 3, 4 |
| 320 | t: u64, i64, f64 |
| 321 | t: u8, u16, u32, i8, i16, i32, f32 |
| 322 | name: convert_#3#1 |
| 323 | arg: #2#1 v compatible(#3) |
| 324 | ret: #3#1 |
| 325 | comment: |
| 326 | Component wise conversion from #2#1 to #3#1. |
| 327 | |
| 328 | For the convert_* functions, conversions of floating point values to integer will truncate. |
| 329 | Conversions of numbers too large to fit the destination type yield undefined results. |
| 330 | For example, converting a float that contains 1.0e18 to a short is undefined. |
| 331 | version: 21 |
| 332 | end: |
| 333 | |
| 334 | start: |
| 335 | w: 2, 3, 4 |
| 336 | t: u8, u16, u32, i8, i16, i32, f32 |
| 337 | t: u64, i64, f64 |
| 338 | name: convert_#3#1 |
| 339 | arg: #2#1 v compatible(#3) |
| 340 | ret: #3#1 |
| 341 | comment: |
| 342 | Component wise conversion from #2#1 to #3#1. |
| 343 | |
| 344 | For the convert_* functions, conversions of floating point values to integer will truncate. |
| 345 | Conversions of numbers too large to fit the destination type yield undefined results. |
| 346 | For example, converting a float that contains 1.0e18 to a short is undefined. |
| 347 | version: 21 |
| 348 | end: |
| 349 | |
| 350 | start: |
| 351 | w: 1, 2, 3, 4 |
| 352 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 353 | name: copysign |
| 354 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 355 | arg: #2#1 magnitude_value |
| 356 | arg: #2#1 sign_value |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 357 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 358 | Copies the sign from sign_value to magnitude_value. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 359 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 360 | The value returned is either magnitude_value or -magnitude_value. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 361 | |
| 362 | For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 363 | version: 9 |
| 364 | end: |
| 365 | |
| 366 | start: |
| 367 | w: 1, 2, 3, 4 |
| 368 | t: f32 |
| 369 | name: cos |
| 370 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 371 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 372 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 373 | Returns the cosine of an angle measured in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 374 | version: 9 |
| 375 | end: |
| 376 | |
| 377 | start: |
| 378 | w: 1, 2, 3, 4 |
| 379 | t: f32 |
| 380 | name: cosh |
| 381 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 382 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 383 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 384 | Returns the hypebolic cosine of v, where v is measured in radians. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 385 | version: 9 |
| 386 | end: |
| 387 | |
| 388 | start: |
| 389 | w: 1, 2, 3, 4 |
| 390 | t: f32 |
| 391 | name: cospi |
| 392 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 393 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 394 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 395 | Returns the cosine of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 396 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 397 | To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 398 | version: 9 |
| 399 | end: |
| 400 | |
| 401 | start: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 402 | w: 3, 4 |
| 403 | t: f32 |
| 404 | name: cross |
| 405 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 406 | arg: #2#1 left_vector |
| 407 | arg: #2#1 right_vector |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 408 | comment: |
| 409 | Computes the cross product of two vectors. |
| 410 | version: 9 |
| 411 | test: vector |
| 412 | end: |
| 413 | |
| 414 | start: |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 415 | w: 1, 2, 3, 4 |
| 416 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 417 | name: degrees |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 418 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 419 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 420 | comment: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 421 | Converts from radians to degrees. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 422 | version: 9 |
| 423 | end: |
| 424 | |
| 425 | start: |
| 426 | w: 1, 2, 3, 4 |
| 427 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 428 | name: distance |
| 429 | ret: #2 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 430 | arg: #2#1 left_vector |
| 431 | arg: #2#1 right_vector |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 432 | comment: |
| 433 | Compute the distance between two points. |
| 434 | version: 9 |
| 435 | test: vector |
| 436 | end: |
| 437 | |
| 438 | start: |
| 439 | w: 1, 2, 3, 4 |
| 440 | t: f32 |
| 441 | name: dot |
| 442 | ret: #2 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 443 | arg: #2#1 left_vector |
| 444 | arg: #2#1 right_vector |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 445 | comment: |
| 446 | Computes the dot product of two vectors. |
| 447 | version: 9 |
| 448 | test: vector |
| 449 | end: |
| 450 | |
| 451 | start: |
| 452 | w: 1, 2, 3, 4 |
| 453 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 454 | name: erf |
| 455 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 456 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 457 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 458 | Returns the error function. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 459 | version: 9 |
| 460 | end: |
| 461 | |
| 462 | start: |
| 463 | w: 1, 2, 3, 4 |
| 464 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 465 | name: erfc |
| 466 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 467 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 468 | comment: |
| 469 | Returns the complementary error function. |
| 470 | version: 9 |
| 471 | end: |
| 472 | |
| 473 | start: |
| 474 | w: 1, 2, 3, 4 |
| 475 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 476 | name: exp |
| 477 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 478 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 479 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 480 | Returns e raised to v, i.e. e ^ v. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 481 | version: 9 |
| 482 | end: |
| 483 | |
| 484 | start: |
| 485 | w: 1, 2, 3, 4 |
| 486 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 487 | name: exp10 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 488 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 489 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 490 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 491 | Returns 10 raised to v, i.e. 10.f ^ v. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 492 | version: 9 |
| 493 | end: |
| 494 | |
| 495 | start: |
| 496 | w: 1, 2, 3, 4 |
| 497 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 498 | name: exp2 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 499 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 500 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 501 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 502 | Returns 2 raised to v, i.e. 2.f ^ v. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 503 | version: 9 |
| 504 | end: |
| 505 | |
| 506 | start: |
| 507 | w: 1, 2, 3, 4 |
| 508 | t: f32 |
| 509 | name: expm1 |
| 510 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 511 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 512 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 513 | Returns e raised to v minus 1, i.e. (e ^ v) - 1. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 514 | version: 9 |
| 515 | end: |
| 516 | |
| 517 | start: |
| 518 | w: 1, 2, 3, 4 |
| 519 | t: f32 |
| 520 | name: fabs |
| 521 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 522 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 523 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 524 | Returns the absolute value of the float v. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 525 | |
| 526 | For integers, use abs(). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 527 | version: 9 |
| 528 | end: |
| 529 | |
| 530 | start: |
| 531 | w: 1, 2, 3, 4 |
| 532 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 533 | name: fast_distance |
| 534 | ret: #2 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 535 | arg: #2#1 left_vector |
| 536 | arg: #2#1 right_vector |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 537 | comment: |
| 538 | Computes the approximate distance between two points. |
| 539 | |
| 540 | The precision is what would be expected from doing the computation using 16 bit floating point values. |
| 541 | version: 17 |
| 542 | test: vector |
| 543 | end: |
| 544 | |
| 545 | start: |
| 546 | w: 1, 2, 3, 4 |
| 547 | t: f32 |
| 548 | name: fast_length |
| 549 | ret: #2 |
| 550 | arg: #2#1 v |
| 551 | comment: |
| 552 | Computes the approximate length of a vector. |
| 553 | |
| 554 | The precision is what would be expected from doing the computation using 16 bit floating point values. |
| 555 | version: 17 |
| 556 | test: vector |
| 557 | end: |
| 558 | |
| 559 | start: |
| 560 | w: 1, 2, 3, 4 |
| 561 | t: f32 |
| 562 | name: fast_normalize |
| 563 | ret: #2#1 |
| 564 | arg: #2#1 v |
| 565 | comment: |
| 566 | Approximately normalizes a vector. |
| 567 | |
| 568 | For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values. |
| 569 | |
| 570 | The precision is what would be expected from doing the computation using 16 bit floating point values. |
| 571 | version: 17 |
| 572 | test: vector |
| 573 | end: |
| 574 | |
| 575 | start: |
| 576 | w: 1, 2, 3, 4 |
| 577 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 578 | name: fdim |
| 579 | ret: #2#1 |
Jean-Luc Brouillet | 963c367 | 2014-02-12 20:58:47 -0800 | [diff] [blame] | 580 | arg: #2#1 a |
| 581 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 582 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 583 | Returns the positive difference between two values. |
| 584 | |
| 585 | If a > b, returns (a - b) otherwise returns 0f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 586 | version: 9 |
| 587 | end: |
| 588 | |
| 589 | start: |
| 590 | w: 1, 2, 3, 4 |
| 591 | t: f32 |
| 592 | name: floor |
| 593 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 594 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 595 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 596 | Returns the smallest integer not greater than a value. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 597 | version: 9 |
| 598 | end: |
| 599 | |
| 600 | start: |
| 601 | w: 1, 2, 3, 4 |
| 602 | t: f32 |
| 603 | name: fma |
| 604 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 605 | arg: #2#1 multiplicand1 |
| 606 | arg: #2#1 multiplicand2 |
| 607 | arg: #2#1 offset |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 608 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 609 | Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 610 | |
| 611 | This function is identical to mad(). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 612 | version: 9 |
| 613 | end: |
| 614 | |
| 615 | start: |
| 616 | w: 1, 2, 3, 4 |
| 617 | t: f32 |
| 618 | name: fmax |
| 619 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 620 | arg: #2#1 a |
| 621 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 622 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 623 | Returns the maximum of a and b, i.e. (a < b ? b : a). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 624 | |
| 625 | The max() function returns identical results but can be applied to more data types. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 626 | version: 9 |
| 627 | end: |
| 628 | |
| 629 | start: |
Jean-Luc Brouillet | 43587eb | 2014-02-04 15:42:53 -0800 | [diff] [blame] | 630 | w: 2, 3, 4 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 631 | t: f32 |
| 632 | name: fmax |
| 633 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 634 | arg: #2#1 a |
| 635 | arg: #2 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 636 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 637 | Returns the maximum of a and b, i.e. (a < b ? b : a). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 638 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 639 | Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 640 | version: 9 |
| 641 | end: |
| 642 | |
| 643 | start: |
| 644 | w: 1, 2, 3, 4 |
| 645 | t: f32 |
| 646 | name: fmin |
| 647 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 648 | arg: #2#1 a |
| 649 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 650 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 651 | Returns the minimum of a and b, i.e. (a > b ? b : a). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 652 | |
| 653 | The min() function returns identical results but can be applied to more data types. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 654 | version: 9 |
| 655 | end: |
| 656 | |
| 657 | start: |
Jean-Luc Brouillet | 43587eb | 2014-02-04 15:42:53 -0800 | [diff] [blame] | 658 | w: 2, 3, 4 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 659 | t: f32 |
| 660 | name: fmin |
| 661 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 662 | arg: #2#1 a |
| 663 | arg: #2 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 664 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 665 | Returns the minimum of a and b, i.e. (a > b ? b : a) |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 666 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 667 | Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 668 | version: 9 |
| 669 | end: |
| 670 | |
| 671 | start: |
| 672 | w: 1, 2, 3, 4 |
| 673 | t: f32 |
| 674 | name: fmod |
| 675 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 676 | arg: #2#1 numerator |
| 677 | arg: #2#1 denominator |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 678 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 679 | Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 680 | |
| 681 | The function remainder() is similar but rounds toward the closest interger. |
| 682 | For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 683 | while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 684 | version: 9 |
| 685 | end: |
| 686 | |
| 687 | start: |
| 688 | w: 1, 2, 3, 4 |
| 689 | t: f32 |
| 690 | name: fract |
| 691 | ret: #2#1 |
| 692 | arg: #2#1 v |
Jean-Luc Brouillet | 963c367 | 2014-02-12 20:58:47 -0800 | [diff] [blame] | 693 | arg: #2#1 *floor |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 694 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 695 | Returns the positive fractional part of v, i.e. v - floor(v). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 696 | |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 697 | For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f. |
| 698 | fract(-1.3f, &val) returns 0.7f and sets val to -2.f. |
| 699 | |
| 700 | @param v Input value. |
| 701 | @param floor If floor is not null, each element of floor will be set to the floor of the corresponding element of v. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 702 | version: 9 |
| 703 | end: |
| 704 | |
| 705 | start: |
| 706 | w: 1, 2, 3, 4 |
| 707 | t: f32 |
| 708 | name: fract |
| 709 | ret: #2#1 |
| 710 | arg: #2#1 v |
| 711 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 712 | Returns the positive fractional part of v, i.e. v - floor(v). |
| 713 | |
| 714 | For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f. |
| 715 | fract(-1.3f, &val) returns 0.7f and sets val to -2.f. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 716 | inline: |
| 717 | #2#1 unused; |
| 718 | return fract(v, &unused); |
| 719 | version: 9 |
| 720 | end: |
| 721 | |
| 722 | start: |
| 723 | w: 1, 2, 3, 4 |
| 724 | t: f32 |
| 725 | name: frexp |
| 726 | ret: #2#1 |
| 727 | arg: #2#1 v |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 728 | arg: int#1 *exponent |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 729 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 730 | Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent. |
| 731 | |
| 732 | The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive). |
| 733 | See ldexp() for the reverse operation. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 734 | |
| 735 | @param v Supports float, float2, float3, float4. |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 736 | @param exponent If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 737 | version: 9 |
| 738 | end: |
| 739 | |
| 740 | start: |
| 741 | w: 1, 2, 3, 4 |
| 742 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 743 | name: half_recip |
| 744 | ret: #2#1 |
| 745 | arg: #2#1 v |
| 746 | comment: |
| 747 | Returns the approximate reciprocal of a value. |
| 748 | |
| 749 | The precision is that of a 16 bit floating point value. |
| 750 | version: 17 |
| 751 | end: |
| 752 | |
| 753 | start: |
| 754 | w: 1, 2, 3, 4 |
| 755 | t: f32 |
| 756 | name: half_rsqrt |
| 757 | ret: #2#1 |
| 758 | arg: #2#1 v |
| 759 | comment: |
| 760 | Returns the approximate value of (1.f / sqrt(value)). |
| 761 | |
| 762 | The precision is that of a 16 bit floating point value. |
| 763 | version: 17 |
| 764 | end: |
| 765 | |
| 766 | start: |
| 767 | w: 1, 2, 3, 4 |
| 768 | t: f32 |
| 769 | name: half_sqrt |
| 770 | ret: #2#1 |
| 771 | arg: #2#1 v |
| 772 | comment: |
| 773 | Returns the approximate square root of a value. |
| 774 | |
| 775 | The precision is that of a 16 bit floating point value. |
| 776 | version: 17 |
| 777 | end: |
| 778 | |
| 779 | start: |
| 780 | w: 1, 2, 3, 4 |
| 781 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 782 | name: hypot |
| 783 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 784 | arg: #2#1 a |
| 785 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 786 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 787 | Returns the hypotenuse, i.e. sqrt(a * a + b * b). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 788 | version: 9 |
| 789 | end: |
| 790 | |
| 791 | start: |
| 792 | w: 1, 2, 3, 4 |
| 793 | t: f32 |
| 794 | name: ilogb |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 795 | ret: int#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 796 | arg: float#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 797 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 798 | Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive). |
| 799 | |
| 800 | For example, ilogb(8.5f) returns 3. Because of the difference in mantissa, this number is one less than |
| 801 | is returned by frexp(). |
| 802 | |
| 803 | logb() is similar but returns a float. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 804 | version: 9 |
Jean-Luc Brouillet | 9390664 | 2014-07-23 21:25:45 -0700 | [diff] [blame] | 805 | test: custom |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 806 | end: |
| 807 | |
| 808 | start: |
| 809 | w: 1, 2, 3, 4 |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 810 | name: ldexp |
| 811 | ret: float#1 |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 812 | arg: float#1 mantissa |
| 813 | arg: int#1 exponent |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 814 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 815 | Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent). |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 816 | |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 817 | See frexp() for the reverse operation. |
| 818 | |
| 819 | @param mantissa Supports float, float2, float3, and float4. |
| 820 | @param exponent Supports single component or matching vector. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 821 | version: 9 |
| 822 | end: |
| 823 | |
| 824 | start: |
| 825 | w: 2, 3, 4 |
| 826 | name: ldexp |
| 827 | ret: float#1 |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 828 | arg: float#1 mantissa |
| 829 | arg: int exponent |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 830 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 831 | Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent). |
| 832 | See frexp() for the reverse operation. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 833 | |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 834 | @param mantissa Supports float, float2, float3, and float4. |
| 835 | @param exponent Supports single component or matching vector. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 836 | version: 9 |
| 837 | end: |
| 838 | |
| 839 | start: |
| 840 | w: 1, 2, 3, 4 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 841 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 842 | name: length |
| 843 | ret: #2 |
| 844 | arg: #2#1 v |
| 845 | comment: |
| 846 | Computes the length of a vector. |
| 847 | version: 9 |
| 848 | test: vector |
| 849 | end: |
| 850 | |
| 851 | start: |
| 852 | w: 1, 2, 3, 4 |
| 853 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 854 | name: lgamma |
| 855 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 856 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 857 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 858 | Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 859 | version: 9 |
| 860 | end: |
| 861 | |
| 862 | start: |
| 863 | w: 1, 2, 3, 4 |
| 864 | t: f32 |
| 865 | name: lgamma |
| 866 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 867 | arg: #2#1 v |
| 868 | arg: int#1 *sign_of_gamma |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 869 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 870 | Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 871 | |
| 872 | Can also return the sign of the gamma function. |
| 873 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 874 | @param v Input value. |
| 875 | @param sign_of_gamma If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 876 | |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 877 | version: 9 |
Jean-Luc Brouillet | 631b9e3 | 2014-09-18 14:12:37 -0700 | [diff] [blame] | 878 | #TODO Temporary until bionic & associated drivers are fixed |
| 879 | test: custom |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 880 | end: |
| 881 | |
| 882 | start: |
| 883 | w: 1, 2, 3, 4 |
| 884 | t: f32 |
| 885 | name: log |
| 886 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 887 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 888 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 889 | Returns the natural logarithm. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 890 | version: 9 |
| 891 | end: |
| 892 | |
| 893 | start: |
| 894 | w: 1, 2, 3, 4 |
| 895 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 896 | name: log10 |
| 897 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 898 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 899 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 900 | Returns the base 10 logarithm. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 901 | version: 9 |
| 902 | end: |
| 903 | |
| 904 | start: |
| 905 | w: 1, 2, 3, 4 |
| 906 | t: f32 |
| 907 | name: log1p |
| 908 | ret: #2#1 |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 909 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 910 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 911 | Returns the natural logarithm of (v + 1.f). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 912 | version: 9 |
| 913 | end: |
| 914 | |
| 915 | start: |
| 916 | w: 1, 2, 3, 4 |
| 917 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 918 | name: log2 |
| 919 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 920 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 921 | comment: |
| 922 | Returns the base 2 logarithm. |
| 923 | version: 9 |
| 924 | end: |
| 925 | |
| 926 | start: |
| 927 | w: 1, 2, 3, 4 |
| 928 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 929 | name: logb |
| 930 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 931 | arg: #2#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 932 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 933 | Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive). |
| 934 | |
Stephen Hines | 7d6c9ba | 2015-01-16 16:34:28 -0800 | [diff] [blame] | 935 | For example, logb(8.5f) returns 3.f. Because of the difference in mantissa, this number is one less than |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 936 | is returned by frexp(). |
| 937 | |
| 938 | ilogb() is similar but returns an integer. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 939 | version: 9 |
| 940 | end: |
| 941 | |
| 942 | start: |
| 943 | w: 1, 2, 3, 4 |
| 944 | t: f32 |
| 945 | name: mad |
| 946 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 947 | arg: #2#1 multiplicand1 |
| 948 | arg: #2#1 multiplicand2 |
| 949 | arg: #2#1 offset |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 950 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 951 | Multiply and add. Returns (multiplicand1 * multiplicand2) + offset. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 952 | |
| 953 | This function is identical to fma(). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 954 | version: 9 |
| 955 | end: |
| 956 | |
| 957 | start: |
| 958 | w: 1, 2, 3, 4 |
| 959 | t: f32 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 960 | name: max |
| 961 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 962 | arg: #2#1 a |
| 963 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 964 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 965 | Returns the maximum value of two arguments. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 966 | version: 9 |
| 967 | end: |
| 968 | |
| 969 | start: |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 970 | w: 1 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 971 | t: i8 i16 i32 u8 u16 u32 |
| 972 | name: max |
| 973 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 974 | arg: #2#1 a |
| 975 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 976 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 977 | Returns the maximum value of two arguments. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 978 | inline: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 979 | return (a > b ? a : b); |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 980 | version: 9 19 |
| 981 | end: |
| 982 | |
| 983 | start: |
| 984 | w: 2 |
| 985 | t: i8 i16 i32 u8 u16 u32 |
| 986 | name: max |
| 987 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 988 | arg: #2#1 a |
| 989 | arg: #2#1 b |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 990 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 991 | Returns the maximum value of two arguments. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 992 | inline: |
| 993 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 994 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 995 | tmp.y = (a.y > b.y ? a.y : b.y); |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 996 | return tmp; |
| 997 | version: 9 19 |
| 998 | end: |
| 999 | |
| 1000 | start: |
| 1001 | w: 3 |
| 1002 | t: i8 i16 i32 u8 u16 u32 |
| 1003 | name: max |
| 1004 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1005 | arg: #2#1 a |
| 1006 | arg: #2#1 b |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1007 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1008 | Returns the maximum value of two arguments. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1009 | inline: |
| 1010 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1011 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1012 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1013 | tmp.z = (a.z > b.z ? a.z : b.z); |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1014 | return tmp; |
| 1015 | version: 9 19 |
| 1016 | end: |
| 1017 | |
| 1018 | start: |
| 1019 | w: 4 |
| 1020 | t: i8 i16 i32 u8 u16 u32 |
| 1021 | name: max |
| 1022 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1023 | arg: #2#1 a |
| 1024 | arg: #2#1 b |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1025 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1026 | Returns the maximum value of two arguments. |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1027 | inline: |
| 1028 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1029 | tmp.x = (a.x > b.x ? a.x : b.x); |
| 1030 | tmp.y = (a.y > b.y ? a.y : b.y); |
| 1031 | tmp.z = (a.z > b.z ? a.z : b.z); |
| 1032 | tmp.w = (a.w > b.w ? a.w : b.w); |
Jason Sams | ea877ed | 2014-01-09 15:48:32 -0800 | [diff] [blame] | 1033 | return tmp; |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1034 | version: 9 19 |
| 1035 | end: |
| 1036 | |
| 1037 | start: |
| 1038 | w: 1, 2, 3, 4 |
| 1039 | t: i8 i16 i32 i64 u8 u16 u32 u64 |
| 1040 | name: max |
| 1041 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1042 | arg: #2#1 a |
| 1043 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1044 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1045 | Returns the maximum value of two arguments. |
Jason Sams | aa45693 | 2014-08-18 16:20:51 -0700 | [diff] [blame] | 1046 | version: 21 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1047 | end: |
| 1048 | |
| 1049 | start: |
| 1050 | w: 1, 2, 3, 4 |
| 1051 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1052 | name: min |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1053 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1054 | arg: #2#1 a |
| 1055 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1056 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1057 | Returns the minimum value of two arguments. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1058 | version: 9 |
| 1059 | end: |
| 1060 | |
| 1061 | start: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1062 | w: 1 |
| 1063 | t: i8 i16 i32 u8 u16 u32 |
| 1064 | name: min |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1065 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1066 | arg: #2#1 a |
| 1067 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1068 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1069 | Returns the minimum value of two arguments. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1070 | inline: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1071 | return (a < b ? a : b); |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1072 | version: 9 19 |
| 1073 | end: |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1074 | |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1075 | start: |
| 1076 | w: 2 |
| 1077 | t: i8 i16 i32 u8 u16 u32 |
| 1078 | name: min |
| 1079 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1080 | arg: #2#1 a |
| 1081 | arg: #2#1 b |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1082 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1083 | Returns the minimum value of two arguments. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1084 | inline: |
| 1085 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1086 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 1087 | tmp.y = (a.y < b.y ? a.y : b.y); |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1088 | return tmp; |
| 1089 | version: 9 19 |
| 1090 | end: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1091 | |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1092 | start: |
| 1093 | w: 3 |
| 1094 | t: i8 i16 i32 u8 u16 u32 |
| 1095 | name: min |
| 1096 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1097 | arg: #2#1 a |
| 1098 | arg: #2#1 b |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1099 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1100 | Returns the minimum value of two arguments. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1101 | inline: |
| 1102 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1103 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 1104 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 1105 | tmp.z = (a.z < b.z ? a.z : b.z); |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1106 | return tmp; |
| 1107 | version: 9 19 |
| 1108 | end: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1109 | |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1110 | start: |
| 1111 | w: 4 |
| 1112 | t: i8 i16 i32 u8 u16 u32 |
| 1113 | name: min |
| 1114 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1115 | arg: #2#1 a |
| 1116 | arg: #2#1 b |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1117 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1118 | Returns the minimum value of two arguments. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1119 | inline: |
| 1120 | #2#1 tmp; |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1121 | tmp.x = (a.x < b.x ? a.x : b.x); |
| 1122 | tmp.y = (a.y < b.y ? a.y : b.y); |
| 1123 | tmp.z = (a.z < b.z ? a.z : b.z); |
| 1124 | tmp.w = (a.w < b.w ? a.w : b.w); |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1125 | return tmp; |
| 1126 | version: 9 19 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1127 | end: |
| 1128 | |
| 1129 | start: |
| 1130 | w: 1, 2, 3, 4 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1131 | t: i8 i16 i32 i64 u8 u16 u32 u64 |
| 1132 | name: min |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1133 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1134 | arg: #2#1 a |
| 1135 | arg: #2#1 b |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1136 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1137 | Returns the minimum value of two arguments. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1138 | version: 21 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1139 | end: |
| 1140 | |
| 1141 | start: |
| 1142 | w: 1, 2, 3, 4 |
| 1143 | t: f32 |
| 1144 | name: mix |
| 1145 | ret: #2#1 |
| 1146 | arg: #2#1 start |
| 1147 | arg: #2#1 stop |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1148 | arg: #2#1 fraction |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1149 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1150 | Returns start + ((stop - start) * fraction). |
| 1151 | |
| 1152 | This can be useful for mixing two values. For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1153 | version: 9 |
| 1154 | end: |
| 1155 | |
| 1156 | start: |
Jean-Luc Brouillet | 43587eb | 2014-02-04 15:42:53 -0800 | [diff] [blame] | 1157 | w: 2, 3, 4 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1158 | t: f32 |
| 1159 | name: mix |
| 1160 | ret: #2#1 |
| 1161 | arg: #2#1 start |
| 1162 | arg: #2#1 stop |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1163 | arg: #2 fraction |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1164 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1165 | Returns start + ((stop - start) * fraction). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1166 | |
| 1167 | This can be useful for mixing two values. For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f). |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1168 | version: 9 |
| 1169 | end: |
| 1170 | |
| 1171 | start: |
| 1172 | w: 1, 2, 3, 4 |
| 1173 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1174 | name: modf |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1175 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1176 | arg: #2#1 v |
| 1177 | arg: #2#1 *integral_part |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1178 | comment: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1179 | Returns the integral and fractional components of a number. |
| 1180 | |
| 1181 | Both components will have the same sign as x. For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned. |
| 1182 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1183 | @param v Source value |
| 1184 | @param integral_part integral_part[0] will be set to the integral portion of the number. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1185 | @return The floating point portion of the value. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1186 | version: 9 |
| 1187 | end: |
| 1188 | |
| 1189 | start: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1190 | w: 1 |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1191 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1192 | name: nan |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1193 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1194 | arg: uint#1 v |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1195 | comment: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1196 | Returns a NaN value (Not a Number). |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1197 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1198 | @param v Not used. |
| 1199 | #TODO We're not using the argument. Once we do, add this documentation line: |
| 1200 | # The argument is embedded into the return value and can be used to distinguish various NaNs. |
Jason Sams | 135c4b7 | 2013-12-11 18:24:45 -0800 | [diff] [blame] | 1201 | version: 9 |
| 1202 | end: |
| 1203 | |
| 1204 | start: |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1205 | w: 1, 2, 3, 4 |
| 1206 | t: f32 |
| 1207 | name: native_acos |
| 1208 | ret: #2#1 |
| 1209 | arg: #2#1 v range(-1,1) |
| 1210 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1211 | Returns the approximate inverse cosine, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1212 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1213 | # TODO Temporary |
| 1214 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1215 | end: |
| 1216 | |
| 1217 | start: |
| 1218 | w: 1, 2, 3, 4 |
| 1219 | t: f32 |
| 1220 | name: native_acosh |
| 1221 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1222 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1223 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1224 | Returns the approximate inverse hyperbolic cosine, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1225 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1226 | # TODO Temporary |
| 1227 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1228 | end: |
| 1229 | |
| 1230 | start: |
| 1231 | w: 1, 2, 3, 4 |
| 1232 | t: f32 |
| 1233 | name: native_acospi |
| 1234 | ret: #2#1 |
| 1235 | arg: #2#1 v range(-1,1) |
| 1236 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1237 | Returns the approximate inverse cosine in radians, divided by pi. |
| 1238 | |
| 1239 | To get an inverse cosine measured in degrees, use acospi(a) * 180.f. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1240 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1241 | # TODO Temporary |
| 1242 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1243 | end: |
| 1244 | |
| 1245 | start: |
| 1246 | w: 1, 2, 3, 4 |
| 1247 | t: f32 |
| 1248 | name: native_asin |
| 1249 | ret: #2#1 |
| 1250 | arg: #2#1 v range(-1,1) |
| 1251 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1252 | Returns the approximate inverse sine, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1253 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1254 | # TODO Temporary |
| 1255 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1256 | end: |
| 1257 | |
| 1258 | start: |
| 1259 | w: 1, 2, 3, 4 |
| 1260 | t: f32 |
| 1261 | name: native_asinh |
| 1262 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1263 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1264 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1265 | Returns the approximate inverse hyperbolic sine, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1266 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1267 | # TODO Temporary |
| 1268 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1269 | end: |
| 1270 | |
| 1271 | start: |
| 1272 | w: 1, 2, 3, 4 |
| 1273 | t: f32 |
| 1274 | name: native_asinpi |
| 1275 | ret: #2#1 |
| 1276 | arg: #2#1 v range(-1,1) |
| 1277 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1278 | Returns the approximate inverse sine in radians, divided by pi. |
| 1279 | |
| 1280 | To get an inverse sine measured in degrees, use asinpi(a) * 180.f. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1281 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1282 | # TODO Temporary |
| 1283 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1284 | end: |
| 1285 | |
| 1286 | start: |
| 1287 | w: 1, 2, 3, 4 |
| 1288 | t: f32 |
| 1289 | name: native_atan |
| 1290 | ret: #2#1 |
| 1291 | arg: #2#1 v range(-1,1) |
| 1292 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1293 | Returns the approximate inverse tangent, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1294 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1295 | # TODO Temporary |
| 1296 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1297 | end: |
| 1298 | |
| 1299 | start: |
| 1300 | w: 1, 2, 3, 4 |
| 1301 | t: f32 |
| 1302 | name: native_atan2 |
| 1303 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1304 | arg: #2#1 numerator |
| 1305 | arg: #2#1 denominator |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1306 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1307 | Returns the approximate inverse tangent of numerator / denominator, in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1308 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1309 | denominator can be 0. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1310 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1311 | # TODO Temporary |
| 1312 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1313 | end: |
| 1314 | |
| 1315 | start: |
| 1316 | w: 1, 2, 3, 4 |
| 1317 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1318 | name: native_atan2pi |
| 1319 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1320 | arg: #2#1 numerator |
| 1321 | arg: #2#1 denominator |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1322 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1323 | Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1324 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1325 | To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1326 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1327 | denominator can be 0. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1328 | version: 21 |
| 1329 | # TODO Temporary |
| 1330 | test: limited(0.0005) |
| 1331 | end: |
| 1332 | |
| 1333 | start: |
| 1334 | w: 1, 2, 3, 4 |
| 1335 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1336 | name: native_atanh |
| 1337 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1338 | arg: #2#1 v range(-1,1) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1339 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1340 | Returns the approximate inverse hyperbolic tangent, in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1341 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1342 | # TODO Temporary |
| 1343 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1344 | end: |
| 1345 | |
| 1346 | start: |
| 1347 | w: 1, 2, 3, 4 |
| 1348 | t: f32 |
| 1349 | name: native_atanpi |
| 1350 | ret: #2#1 |
| 1351 | arg: #2#1 v range(-1,1) |
| 1352 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1353 | Returns the approximate inverse tangent in radians, divided by pi. |
| 1354 | |
| 1355 | To get an inverse tangent measured in degrees, use atanpi(a) * 180.f. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1356 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1357 | # TODO Temporary |
| 1358 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1359 | end: |
| 1360 | |
| 1361 | start: |
| 1362 | w: 1, 2, 3, 4 |
| 1363 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1364 | name: native_cbrt |
| 1365 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1366 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1367 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1368 | Returns the approximate cubic root. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1369 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1370 | end: |
| 1371 | |
| 1372 | start: |
| 1373 | w: 1, 2, 3, 4 |
| 1374 | t: f32 |
| 1375 | name: native_cos |
| 1376 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1377 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1378 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1379 | Returns the approximate cosine of an angle measured in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1380 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1381 | end: |
| 1382 | |
| 1383 | start: |
| 1384 | w: 1, 2, 3, 4 |
| 1385 | t: f32 |
| 1386 | name: native_cosh |
| 1387 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1388 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1389 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1390 | Returns the approximate hypebolic cosine. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1391 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1392 | end: |
| 1393 | |
| 1394 | start: |
| 1395 | w: 1, 2, 3, 4 |
| 1396 | t: f32 |
| 1397 | name: native_cospi |
| 1398 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1399 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1400 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1401 | Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1402 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1403 | To get the cosine of a value measured in degrees, call cospi(v / 180.f). |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1404 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1405 | end: |
| 1406 | |
| 1407 | start: |
| 1408 | w: 1, 2, 3, 4 |
| 1409 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1410 | name: native_distance |
| 1411 | ret: #2 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1412 | arg: #2#1 left_vector |
| 1413 | arg: #2#1 right_vector |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1414 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1415 | Computes the approximate distance between two points. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1416 | version: 21 |
Jean-Luc Brouillet | 1b0707d | 2014-07-24 13:27:26 -0700 | [diff] [blame] | 1417 | test: vector |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1418 | end: |
| 1419 | |
| 1420 | start: |
| 1421 | w: 1, 2, 3, 4 |
| 1422 | t: f32 |
| 1423 | name: native_divide |
| 1424 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1425 | arg: #2#1 left_vector |
| 1426 | arg: #2#1 right_vector |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1427 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1428 | Computes the approximate division result of two values. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1429 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1430 | end: |
| 1431 | |
| 1432 | start: |
| 1433 | w: 1, 2, 3, 4 |
| 1434 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1435 | name: native_exp |
| 1436 | ret: #2#1 |
| 1437 | arg: #2#1 v range(-86,86) |
| 1438 | comment: |
| 1439 | Fast approximate exp. |
| 1440 | |
| 1441 | It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be expected from using 16 bit floating point values. |
| 1442 | version: 18 |
| 1443 | test: limited |
| 1444 | end: |
| 1445 | |
| 1446 | start: |
| 1447 | w: 1, 2, 3, 4 |
| 1448 | t: f32 |
| 1449 | name: native_exp10 |
| 1450 | ret: #2#1 |
| 1451 | arg: #2#1 v range(-37,37) |
| 1452 | comment: |
| 1453 | Fast approximate exp10. |
| 1454 | |
| 1455 | It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be expected from using 16 bit floating point values. |
| 1456 | version: 18 |
| 1457 | test: limited |
| 1458 | end: |
| 1459 | |
| 1460 | start: |
| 1461 | w: 1, 2, 3, 4 |
| 1462 | t: f32 |
| 1463 | name: native_exp2 |
| 1464 | ret: #2#1 |
| 1465 | arg: #2#1 v range(-125,125) |
| 1466 | comment: |
| 1467 | Fast approximate exp2. |
| 1468 | |
| 1469 | It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be expected from using 16 bit floating point values. |
| 1470 | version: 18 |
| 1471 | test: limited |
| 1472 | end: |
| 1473 | |
| 1474 | start: |
| 1475 | w: 1, 2, 3, 4 |
| 1476 | t: f32 |
| 1477 | name: native_expm1 |
| 1478 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1479 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1480 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1481 | Returns the approximate (e ^ v) - 1. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1482 | version: 21 |
| 1483 | end: |
| 1484 | |
| 1485 | start: |
| 1486 | w: 1, 2, 3, 4 |
| 1487 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1488 | name: native_hypot |
| 1489 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1490 | arg: #2#1 a |
| 1491 | arg: #2#1 b |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1492 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1493 | Returns the approximate native_sqrt(a * a + b * b) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1494 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1495 | end: |
| 1496 | |
| 1497 | start: |
| 1498 | w: 1, 2, 3, 4 |
| 1499 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1500 | name: native_length |
| 1501 | ret: #2 |
| 1502 | arg: #2#1 v |
| 1503 | comment: |
| 1504 | Compute the approximate length of a vector. |
| 1505 | version: 21 |
| 1506 | test: vector |
| 1507 | end: |
| 1508 | |
| 1509 | start: |
| 1510 | w: 1, 2, 3, 4 |
| 1511 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1512 | name: native_log |
| 1513 | ret: #2#1 |
| 1514 | arg: #2#1 v range(10e-10,10e10) |
| 1515 | comment: |
| 1516 | Fast approximate log. |
| 1517 | |
| 1518 | It is not accurate for values very close to zero. |
| 1519 | version: 18 |
| 1520 | test: limited |
| 1521 | end: |
| 1522 | |
| 1523 | start: |
| 1524 | w: 1, 2, 3, 4 |
| 1525 | t: f32 |
| 1526 | name: native_log10 |
| 1527 | ret: #2#1 |
| 1528 | arg: #2#1 v range(10e-10,10e10) |
| 1529 | comment: |
| 1530 | Fast approximate log10. |
| 1531 | |
| 1532 | It is not accurate for values very close to zero. |
| 1533 | version: 18 |
| 1534 | test: limited |
| 1535 | end: |
| 1536 | |
| 1537 | start: |
| 1538 | w: 1, 2, 3, 4 |
| 1539 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1540 | name: native_log1p |
| 1541 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1542 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1543 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1544 | Returns the approximate natural logarithm of (v + 1.0f) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1545 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1546 | end: |
| 1547 | |
| 1548 | start: |
| 1549 | w: 1, 2, 3, 4 |
| 1550 | t: f32 |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1551 | name: native_log2 |
| 1552 | ret: #2#1 |
| 1553 | arg: #2#1 v range(10e-10,10e10) |
| 1554 | comment: |
| 1555 | Fast approximate log2. |
| 1556 | |
| 1557 | It is not accurate for values very close to zero. |
| 1558 | version: 18 |
| 1559 | test: limited |
| 1560 | end: |
| 1561 | |
| 1562 | start: |
| 1563 | w: 1, 2, 3, 4 |
| 1564 | t: f32 |
| 1565 | name: native_normalize |
| 1566 | ret: #2#1 |
| 1567 | arg: #2#1 v |
| 1568 | comment: |
| 1569 | Approximately normalizes a vector. |
| 1570 | version: 21 |
| 1571 | test: vector |
| 1572 | end: |
| 1573 | |
| 1574 | start: |
| 1575 | w: 1, 2, 3, 4 |
| 1576 | t: f32 |
| 1577 | name: native_powr |
| 1578 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1579 | arg: #2#1 base range(0,256) |
| 1580 | arg: #2#1 exponent range(-15,15) |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1581 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1582 | Fast approximate (base ^ exponent). |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1583 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1584 | @param base Must be between 0.f and 256.f. The function is not accurate for values very close to zero. |
| 1585 | @param exponent Must be between -15.f and 15.f. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1586 | version: 18 |
| 1587 | test: limited |
| 1588 | end: |
| 1589 | |
| 1590 | start: |
| 1591 | w: 1, 2, 3, 4 |
| 1592 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1593 | name: native_recip |
| 1594 | ret: #2#1 |
| 1595 | arg: #2#1 v |
| 1596 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1597 | Returns the approximate approximate reciprocal of a value. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1598 | version: 21 |
| 1599 | end: |
| 1600 | |
| 1601 | start: |
| 1602 | w: 1, 2, 3, 4 |
| 1603 | t: f32 |
| 1604 | name: native_rootn |
| 1605 | ret: #2#1 |
| 1606 | arg: #2#1 v |
| 1607 | arg: int#1 n |
| 1608 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1609 | Compute the approximate Nth root of a value. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1610 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1611 | end: |
| 1612 | |
| 1613 | start: |
| 1614 | w: 1, 2, 3, 4 |
| 1615 | t: f32 |
| 1616 | name: native_rsqrt |
| 1617 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1618 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1619 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1620 | Returns approximate (1 / sqrt(v)). |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1621 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1622 | end: |
| 1623 | |
| 1624 | start: |
| 1625 | w: 1, 2, 3, 4 |
| 1626 | t: f32 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1627 | name: native_sin |
| 1628 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1629 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1630 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1631 | Returns the approximate sine of an angle measured in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1632 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1633 | end: |
| 1634 | |
| 1635 | start: |
| 1636 | w: 1, 2, 3, 4 |
| 1637 | t: f32 |
| 1638 | name: native_sincos |
| 1639 | ret: #2#1 |
| 1640 | arg: #2#1 v |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1641 | arg: #2#1 *cos |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1642 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1643 | Returns the approximate sine and cosine of a value. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1644 | |
| 1645 | @return sine |
| 1646 | @param v The incoming value in radians |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1647 | @param *cos cos[0] will be set to the cosine value. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1648 | version: 21 |
Jean-Luc Brouillet | 45f311c | 2014-09-11 13:53:01 -0700 | [diff] [blame] | 1649 | # TODO Temporary |
| 1650 | test: limited(0.0005) |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1651 | end: |
| 1652 | |
| 1653 | start: |
| 1654 | w: 1, 2, 3, 4 |
| 1655 | t: f32 |
| 1656 | name: native_sinh |
| 1657 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1658 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1659 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1660 | Returns the approximate hyperbolic sine of a value specified in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1661 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1662 | end: |
| 1663 | |
| 1664 | start: |
| 1665 | w: 1, 2, 3, 4 |
| 1666 | t: f32 |
| 1667 | name: native_sinpi |
| 1668 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1669 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1670 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1671 | Returns the approximate sine of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1672 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1673 | To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1674 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1675 | end: |
| 1676 | |
| 1677 | start: |
| 1678 | w: 1, 2, 3, 4 |
| 1679 | t: f32 |
| 1680 | name: native_sqrt |
| 1681 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1682 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1683 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1684 | Returns the approximate sqrt(v). |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1685 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1686 | end: |
| 1687 | |
| 1688 | start: |
| 1689 | w: 1, 2, 3, 4 |
| 1690 | t: f32 |
| 1691 | name: native_tan |
| 1692 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1693 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1694 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1695 | Returns the approximate tangent of an angle measured in radians. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1696 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1697 | end: |
| 1698 | |
| 1699 | start: |
| 1700 | w: 1, 2, 3, 4 |
| 1701 | t: f32 |
| 1702 | name: native_tanh |
| 1703 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1704 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1705 | comment: |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1706 | Returns the approximate hyperbolic tangent of a value. |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1707 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1708 | end: |
| 1709 | |
| 1710 | start: |
| 1711 | w: 1, 2, 3, 4 |
| 1712 | t: f32 |
| 1713 | name: native_tanpi |
| 1714 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1715 | arg: #2#1 v |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1716 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1717 | Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 462e62c | 2014-12-12 13:42:24 -0800 | [diff] [blame] | 1718 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1719 | To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1720 | version: 21 |
Jason Sams | d2d7c18 | 2014-07-17 18:41:25 -0700 | [diff] [blame] | 1721 | end: |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1722 | |
| 1723 | start: |
| 1724 | w: 1, 2, 3, 4 |
| 1725 | t: f32 |
| 1726 | name: nextafter |
| 1727 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1728 | arg: #2#1 v |
| 1729 | arg: #2#1 target |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1730 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1731 | Returns the next floating point number from v towards target. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1732 | version: 9 |
| 1733 | end: |
| 1734 | |
| 1735 | start: |
| 1736 | w: 1, 2, 3, 4 |
| 1737 | t: f32 |
| 1738 | name: normalize |
| 1739 | ret: #2#1 |
| 1740 | arg: #2#1 v |
| 1741 | comment: |
| 1742 | Normalize a vector. |
| 1743 | |
| 1744 | For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values. |
| 1745 | version: 9 |
| 1746 | test: vector |
| 1747 | end: |
| 1748 | |
| 1749 | start: |
| 1750 | w: 1, 2, 3, 4 |
| 1751 | t: f32 |
| 1752 | name: pow |
| 1753 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1754 | arg: #2#1 base |
| 1755 | arg: #2#1 exponent |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1756 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1757 | Returns base raised to the power exponent, i.e. base ^ exponent. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1758 | |
| 1759 | pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the base to be non-negative. |
| 1760 | version: 9 |
| 1761 | end: |
| 1762 | |
| 1763 | start: |
| 1764 | w: 1, 2, 3, 4 |
| 1765 | t: f32 |
| 1766 | name: pown |
| 1767 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1768 | arg: #2#1 base |
| 1769 | arg: int#1 exponent |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1770 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1771 | Returns base raised to the power exponent, i.e. base ^ exponent. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1772 | |
| 1773 | pow() and powr() are similar. The both take a float exponent. powr() also assumes the base to be non-negative. |
| 1774 | version: 9 |
| 1775 | end: |
| 1776 | |
| 1777 | start: |
| 1778 | w: 1, 2, 3, 4 |
| 1779 | t: f32 |
| 1780 | name: powr |
| 1781 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1782 | arg: #2#1 base range(0,3000) |
| 1783 | arg: #2#1 exponent |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1784 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1785 | Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1786 | |
| 1787 | pow() and pown() are similar. They both make no assumptions about the base. pow() takes a float exponent while pown() take an integer. |
| 1788 | version: 9 |
| 1789 | end: |
| 1790 | |
| 1791 | start: |
| 1792 | w: 1, 2, 3, 4 |
| 1793 | t: f32 |
| 1794 | name: radians |
| 1795 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1796 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1797 | comment: |
| 1798 | Converts from degrees to radians. |
| 1799 | version: 9 |
| 1800 | end: |
| 1801 | |
| 1802 | start: |
| 1803 | w: 1, 2, 3, 4 |
| 1804 | t: f32 |
| 1805 | name: remainder |
| 1806 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1807 | arg: #2#1 numerator |
| 1808 | arg: #2#1 denominator |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1809 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1810 | Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1811 | |
| 1812 | The function fmod() is similar but rounds toward the closest interger. |
| 1813 | For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f) |
| 1814 | while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f). |
| 1815 | version: 9 |
| 1816 | end: |
| 1817 | |
| 1818 | start: |
| 1819 | w: 1, 2, 3, 4 |
| 1820 | t: f32 |
| 1821 | name: remquo |
| 1822 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1823 | arg: #2#1 numerator |
| 1824 | arg: #2#1 denominator |
| 1825 | arg: int#1 *quotient |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1826 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1827 | Returns the quotient and the remainder of (numerator / denominator). |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1828 | |
| 1829 | Only the sign and lowest three bits of the quotient are guaranteed to be accurate. |
| 1830 | |
| 1831 | This function is useful for implementing periodic functions. The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant. For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range. |
| 1832 | |
| 1833 | Example: remquo(-23.5f, 8.f, ") sets the lowest three bits of quot to 3 and the sign negative. It returns 0.5f. |
| 1834 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1835 | @param numerator The numerator. |
| 1836 | @param denominator The denominator. |
| 1837 | @param *quotient quotient[0] will be set to the integer quotient. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1838 | @return The remainder, precise only for the low three bits. |
| 1839 | version: 9 |
| 1840 | test: custom |
| 1841 | end: |
| 1842 | |
| 1843 | start: |
| 1844 | w: 1, 2, 3, 4 |
| 1845 | t: f32 |
| 1846 | name: rint |
| 1847 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1848 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1849 | comment: |
| 1850 | Rounds to the nearest integral value. |
| 1851 | |
| 1852 | rint() rounds half values to even. For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f. |
| 1853 | |
| 1854 | round() is similar but rounds away from zero. trunc() truncates the decimal fraction. |
| 1855 | version: 9 |
| 1856 | end: |
| 1857 | |
| 1858 | start: |
| 1859 | w: 1, 2, 3, 4 |
| 1860 | t: f32 |
| 1861 | name: rootn |
| 1862 | ret: #2#1 |
| 1863 | arg: #2#1 v |
| 1864 | arg: int#1 n |
| 1865 | comment: |
| 1866 | Compute the Nth root of a value. |
| 1867 | version: 9 |
| 1868 | end: |
| 1869 | |
| 1870 | start: |
| 1871 | w: 1, 2, 3, 4 |
| 1872 | t: f32 |
| 1873 | name: round |
| 1874 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1875 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1876 | comment: |
| 1877 | Round to the nearest integral value. |
| 1878 | |
| 1879 | round() rounds half values away from zero. For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f. |
| 1880 | |
| 1881 | rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction. |
| 1882 | version: 9 |
| 1883 | end: |
| 1884 | |
| 1885 | start: |
| 1886 | w: 1, 2, 3, 4 |
| 1887 | t: f32 |
| 1888 | name: rsqrt |
| 1889 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1890 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1891 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1892 | Returns (1 / sqrt(v)). |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1893 | version: 9 |
| 1894 | end: |
| 1895 | |
| 1896 | start: |
| 1897 | w: 1, 2, 3, 4 |
| 1898 | t: f32 |
| 1899 | name: sign |
| 1900 | ret: #2#1 |
| 1901 | arg: #2#1 v |
| 1902 | comment: |
| 1903 | Returns the sign of a value. |
| 1904 | |
| 1905 | if (v < 0) return -1.f; |
| 1906 | else if (v > 0) return 1.f; |
| 1907 | else return 0.f; |
| 1908 | version: 9 |
| 1909 | end: |
| 1910 | |
| 1911 | start: |
| 1912 | w: 1, 2, 3, 4 |
| 1913 | t: f32 |
| 1914 | name: sin |
| 1915 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1916 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1917 | comment: |
| 1918 | Returns the sine of an angle measured in radians. |
| 1919 | version: 9 |
| 1920 | end: |
| 1921 | |
| 1922 | start: |
| 1923 | w: 1, 2, 3, 4 |
| 1924 | t: f32 |
| 1925 | name: sincos |
| 1926 | ret: #2#1 |
| 1927 | arg: #2#1 v |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1928 | arg: #2#1 *cos |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1929 | comment: |
| 1930 | Returns the sine and cosine of a value. |
| 1931 | |
| 1932 | @return sine of v |
| 1933 | @param v The incoming value in radians |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1934 | @param *cos cosptr[0] will be set to the cosine value. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1935 | version: 9 |
| 1936 | end: |
| 1937 | |
| 1938 | start: |
| 1939 | w: 1, 2, 3, 4 |
| 1940 | t: f32 |
| 1941 | name: sinh |
| 1942 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1943 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1944 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1945 | Returns the hyperbolic sine of v, where v is measured in radians. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1946 | version: 9 |
| 1947 | end: |
| 1948 | |
| 1949 | start: |
| 1950 | w: 1, 2, 3, 4 |
| 1951 | t: f32 |
| 1952 | name: sinpi |
| 1953 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1954 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1955 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1956 | Returns the sine of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1957 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1958 | To get the sine of a value measured in degrees, call sinpi(v / 180.f). |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1959 | version: 9 |
| 1960 | end: |
| 1961 | |
| 1962 | start: |
| 1963 | w: 1, 2, 3, 4 |
| 1964 | t: f32 |
| 1965 | name: sqrt |
| 1966 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 1967 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 1968 | comment: |
| 1969 | Returns the square root of a value. |
| 1970 | version: 9 |
| 1971 | end: |
| 1972 | |
| 1973 | start: |
| 1974 | w: 1, 2, 3, 4 |
| 1975 | t: f32 |
| 1976 | name: step |
| 1977 | ret: #2#1 |
| 1978 | arg: #2#1 edge |
| 1979 | arg: #2#1 v |
| 1980 | comment: |
| 1981 | Returns 0.f if v < edge, 1.f otherwise. |
| 1982 | |
| 1983 | This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b). |
| 1984 | version: 9 |
| 1985 | end: |
| 1986 | |
| 1987 | start: |
| 1988 | w: 2, 3, 4 |
| 1989 | t: f32 |
| 1990 | name: step |
| 1991 | ret: #2#1 |
| 1992 | arg: #2#1 edge |
| 1993 | arg: #2 v |
| 1994 | comment: |
| 1995 | Returns 0.f if v < edge, 1.f otherwise. |
| 1996 | |
| 1997 | This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b). |
| 1998 | version: 9 |
| 1999 | end: |
| 2000 | |
| 2001 | start: |
| 2002 | w: 2, 3, 4 |
| 2003 | t: f32 |
| 2004 | name: step |
| 2005 | ret: #2#1 |
| 2006 | arg: #2 edge |
| 2007 | arg: #2#1 v |
| 2008 | comment: |
| 2009 | Returns 0.f if v < edge, 1.f otherwise. |
| 2010 | |
| 2011 | This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b). |
| 2012 | version: 21 |
| 2013 | end: |
| 2014 | |
| 2015 | start: |
| 2016 | w: 1, 2, 3, 4 |
| 2017 | t: f32 |
| 2018 | name: tan |
| 2019 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2020 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2021 | comment: |
| 2022 | Returns the tangent of an angle measured in radians. |
| 2023 | version: 9 |
| 2024 | end: |
| 2025 | |
| 2026 | start: |
| 2027 | w: 1, 2, 3, 4 |
| 2028 | t: f32 |
| 2029 | name: tanh |
| 2030 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2031 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2032 | comment: |
| 2033 | Returns the hyperbolic tangent of a value. |
| 2034 | version: 9 |
| 2035 | end: |
| 2036 | |
| 2037 | start: |
| 2038 | w: 1, 2, 3, 4 |
| 2039 | t: f32 |
| 2040 | name: tanpi |
| 2041 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2042 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2043 | comment: |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2044 | Returns the tangent of (v * pi), where (v * pi) is measured in radians. |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2045 | |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2046 | To get the tangent of a value measured in degrees, call tanpi(v / 180.f). |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2047 | version: 9 |
| 2048 | end: |
| 2049 | |
| 2050 | start: |
| 2051 | w: 1, 2, 3, 4 |
| 2052 | t: f32 |
| 2053 | name: tgamma |
| 2054 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2055 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2056 | comment: |
| 2057 | Returns the gamma function of a value. |
| 2058 | version: 9 |
| 2059 | end: |
| 2060 | |
| 2061 | start: |
| 2062 | w: 1, 2, 3, 4 |
| 2063 | t: f32 |
| 2064 | name: trunc |
| 2065 | ret: #2#1 |
Jean-Luc Brouillet | d52feb0 | 2014-12-19 17:32:18 -0800 | [diff] [blame] | 2066 | arg: #2#1 v |
Jean-Luc Brouillet | 7eddce4 | 2014-12-18 15:55:32 -0800 | [diff] [blame] | 2067 | comment: |
| 2068 | Rounds to integral using truncation. |
| 2069 | |
| 2070 | For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f. |
| 2071 | |
| 2072 | See rint() and round() for other rounding options. |
| 2073 | version: 9 |
| 2074 | end: |