blob: b4093e8280fc46bd9ed54405c13427fe6c9a69a9 [file] [log] [blame]
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07001#
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002# Copyright (C) 2014 The Android Open Source Project
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003#
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
17header:
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070018summary: Mathematical Constants and Functions
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070019description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070020 The mathematical functions below can be applied to scalars and vectors. When applied
21 to vectors, the returned value is a vector of the function applied to each entry of the input.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070022
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070023 For example:<code><br/>
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070024 float3 a, b;<br/>
25 // The following call sets<br/>
26 // a.x to sin(b.x),<br/>
27 // a.y to sin(b.y), and<br/>
28 // a.z to sin(b.z).<br/>
29 a = sin(b);<br/>
30 </code>
31
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070032 See <a href='rs_vector_math.html'>Vector Math Functions</a> for functions like @distance() and @length() that interpret
33 instead the input as a single vector in n-dimensional space.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070034
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070035 The precision of the mathematical operations on 32 bit floats is affected by the pragmas
36 rs_fp_relaxed and rs_fp_full. Under rs_fp_relaxed, subnormal values may be flushed to zero and
37 rounding may be done towards zero. In comparison, rs_fp_full requires correct handling of
38 subnormal values, i.e. smaller than 1.17549435e-38f. rs_fp_rull also requires round to nearest
39 with ties to even.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070040
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070041 Different precision/speed tradeoffs can be achieved by using variants of the common math
42 functions. Functions with a name starting with<ul>
43 <li>native_: May have custom hardware implementations with weaker precision. Additionally,
44 subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
45 infinity input may not be handled correctly.</li>
46 <li>half_: May perform internal computations using 16 bit floats. Additionally, subnormal
47 values may be flushed to zero, and rounding towards zero may be used.</li>
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070048 </ul>
49end:
50
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -080051# TODO Add f16 versions of these constants.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070052constant: M_1_PI
53value: 0.318309886183790671537767526745028724f
54summary: 1 / pi, as a 32 bit float
55description:
56 The inverse of pi, as a 32 bit float.
57end:
58
59constant: M_2_PI
60value: 0.636619772367581343075535053490057448f
61summary: 2 / pi, as a 32 bit float
62description:
63 2 divided by pi, as a 32 bit float.
64end:
65
66constant: M_2_PIl
67value: 0.636619772367581343075535053490057448f
68hidden:
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -070069deprecated: 22, Use M_2_PI instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070070summary: 2 / pi, as a 32 bit float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070071description:
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070072 2 divided by pi, as a 32 bit float.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070073end:
74
75constant: M_2_SQRTPI
76value: 1.128379167095512573896158903121545172f
77summary: 2 / sqrt(pi), as a 32 bit float
78description:
79 2 divided by the square root of pi, as a 32 bit float.
80end:
81
82constant: M_E
83value: 2.718281828459045235360287471352662498f
84summary: e, as a 32 bit float
85description:
86 The number e, the base of the natural logarithm, as a 32 bit float.
87end:
88
89constant: M_LN10
90value: 2.302585092994045684017991454684364208f
91summary: log_e(10), as a 32 bit float
92description:
93 The natural logarithm of 10, as a 32 bit float.
94end:
95
96constant: M_LN2
97value: 0.693147180559945309417232121458176568f
98summary: log_e(2), as a 32 bit float
99description:
100 The natural logarithm of 2, as a 32 bit float.
101end:
102
103constant: M_LOG10E
104value: 0.434294481903251827651128918916605082f
105summary: log_10(e), as a 32 bit float
106description:
107 The logarithm base 10 of e, as a 32 bit float.
108end:
109
110constant: M_LOG2E
111value: 1.442695040888963407359924681001892137f
112summary: log_2(e), as a 32 bit float
113description:
114 The logarithm base 2 of e, as a 32 bit float.
115end:
116
117constant: M_PI
118value: 3.141592653589793238462643383279502884f
119summary: pi, as a 32 bit float
120description:
121 The constant pi, as a 32 bit float.
122end:
123
124constant: M_PI_2
125value: 1.570796326794896619231321691639751442f
126summary: pi / 2, as a 32 bit float
127description:
128 Pi divided by 2, as a 32 bit float.
129end:
130
131constant: M_PI_4
132value: 0.785398163397448309615660845819875721f
133summary: pi / 4, as a 32 bit float
134description:
135 Pi divided by 4, as a 32 bit float.
136end:
137
138constant: M_SQRT1_2
139value: 0.707106781186547524400844362104849039f
140summary: 1 / sqrt(2), as a 32 bit float
141description:
142 The inverse of the square root of 2, as a 32 bit float.
143end:
144
145constant: M_SQRT2
146value: 1.414213562373095048801688724209698079f
147summary: sqrt(2), as a 32 bit float
148description:
149 The square root of 2, as a 32 bit float.
150end:
151
152function: abs
153version: 9
154attrib: const
155w: 1, 2, 3, 4
156t: i8, i16, i32
157ret: u#2#1
158arg: #2#1 v
159summary: Absolute value of an integer
160description:
161 Returns the absolute value of an integer.
162
163 For floats, use @fabs().
164end:
165
166function: acos
167version: 9
168attrib: const
169w: 1, 2, 3, 4
170t: f32
171ret: #2#1
172arg: #2#1 v, range(-1,1)
173summary: Inverse cosine
174description:
175 Returns the inverse cosine, in radians.
176
177 See also @native_acos().
178end:
179
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800180function: acos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800181version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800182attrib: const
183w: 1, 2, 3, 4
184t: f16
185ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700186arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800187end:
188
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700189function: acosh
190version: 9
191attrib: const
192w: 1, 2, 3, 4
193t: f32
194ret: #2#1
195arg: #2#1 v
196summary: Inverse hyperbolic cosine
197description:
198 Returns the inverse hyperbolic cosine, in radians.
199
200 See also @native_acosh().
201end:
202
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800203function: acosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800204version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800205attrib: const
206w: 1, 2, 3, 4
207t: f16
208ret: #2#1
209arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800210end:
211
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700212function: acospi
213version: 9
214attrib: const
215w: 1, 2, 3, 4
216t: f32
217ret: #2#1
218arg: #2#1 v, range(-1,1)
219summary: Inverse cosine divided by pi
220description:
221 Returns the inverse cosine in radians, divided by pi.
222
223 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
224
225 See also @native_acospi().
226end:
227
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800228function: acospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800229version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800230attrib: const
231w: 1, 2, 3, 4
232t: f16
233ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700234arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800235end:
236
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700237function: asin
238version: 9
239attrib: const
240w: 1, 2, 3, 4
241t: f32
242ret: #2#1
243arg: #2#1 v, range(-1,1)
244summary: Inverse sine
245description:
246 Returns the inverse sine, in radians.
247
248 See also @native_asin().
249end:
250
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800251function: asin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800252version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800253attrib: const
254w: 1, 2, 3, 4
255t: f16
256ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700257arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800258end:
259
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700260function: asinh
261version: 9
262attrib: const
263w: 1, 2, 3, 4
264t: f32
265ret: #2#1
266arg: #2#1 v
267summary: Inverse hyperbolic sine
268description:
269 Returns the inverse hyperbolic sine, in radians.
270
271 See also @native_asinh().
272end:
273
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800274function: asinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800275version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800276attrib: const
277w: 1, 2, 3, 4
278t: f16
279ret: #2#1
280arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800281end:
282
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700283function: asinpi
284version: 9
285attrib: const
286w: 1, 2, 3, 4
287t: f32
288ret: #2#1
289arg: #2#1 v, range(-1,1)
290summary: Inverse sine divided by pi
291description:
292 Returns the inverse sine in radians, divided by pi.
293
294 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
295
296 See also @native_asinpi().
297end:
298
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800299function: asinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800300version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800301attrib: const
302w: 1, 2, 3, 4
303t: f16
304ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700305arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800306end:
307
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700308function: atan
309version: 9
310attrib: const
311w: 1, 2, 3, 4
312t: f32
313ret: #2#1
314arg: #2#1 v, range(-1,1)
315summary: Inverse tangent
316description:
317 Returns the inverse tangent, in radians.
318
319 See also @native_atan().
320end:
321
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800322function: atan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800323version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800324attrib: const
325w: 1, 2, 3, 4
326t: f16
327ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700328arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800329end:
330
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700331function: atan2
332version: 9
333attrib: const
334w: 1, 2, 3, 4
335t: f32
336ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700337arg: #2#1 numerator, "Numerator."
338arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700339summary: Inverse tangent of a ratio
340description:
341 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians.
342
343 See also @native_atan2().
344end:
345
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800346function: atan2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800347version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800348attrib: const
349w: 1, 2, 3, 4
350t: f16
351ret: #2#1
352arg: #2#1 numerator
353arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800354end:
355
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700356function: atan2pi
357version: 9
358attrib: const
359w: 1, 2, 3, 4
360t: f32
361ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700362arg: #2#1 numerator, "Numerator."
363arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700364summary: Inverse tangent of a ratio, divided by pi
365description:
366 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians, divided by pi.
367
368 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
369
370 See also @native_atan2pi().
371end:
372
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800373function: atan2pi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800374version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800375attrib: const
376w: 1, 2, 3, 4
377t: f16
378ret: #2#1
379arg: #2#1 numerator
380arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800381end:
382
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700383function: atanh
384version: 9
385attrib: const
386w: 1, 2, 3, 4
387t: f32
388ret: #2#1
389arg: #2#1 v, range(-1,1)
390summary: Inverse hyperbolic tangent
391description:
392 Returns the inverse hyperbolic tangent, in radians.
393
394 See also @native_atanh().
395end:
396
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800397function: atanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800398version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800399attrib: const
400w: 1, 2, 3, 4
401t: f16
402ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700403arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800404end:
405
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700406function: atanpi
407version: 9
408attrib: const
409w: 1, 2, 3, 4
410t: f32
411ret: #2#1
412arg: #2#1 v, range(-1,1)
413summary: Inverse tangent divided by pi
414description:
415 Returns the inverse tangent in radians, divided by pi.
416
417 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
418
419 See also @native_atanpi().
420end:
421
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800422function: atanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800423version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800424attrib: const
425w: 1, 2, 3, 4
426t: f16
427ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700428arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800429end:
430
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700431function: cbrt
432version: 9
433attrib: const
434w: 1, 2, 3, 4
435t: f32
436ret: #2#1
437arg: #2#1 v
438summary: Cube root
439description:
440 Returns the cube root.
441
442 See also @native_cbrt().
443end:
444
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800445function: cbrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800446version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800447attrib: const
448w: 1, 2, 3, 4
449t: f16
450ret: #2#1
451arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800452end:
453
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700454function: ceil
455version: 9
456attrib: const
457w: 1, 2, 3, 4
458t: f32
459ret: #2#1
460arg: #2#1 v
461summary: Smallest integer not less than a value
462description:
463 Returns the smallest integer not less than a value.
464
465 For example, <code>ceil(1.2f)</code> returns 2.f, and <code>ceil(-1.2f)</code> returns -1.f.
466
467 See also @floor().
468end:
469
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800470function: ceil
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800471version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800472attrib: const
473w: 1, 2, 3, 4
474t: f16
475ret: #2#1
476arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800477end:
478
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700479function: clamp
480version: 9
481attrib: const
482w: 1, 2, 3, 4
483t: f32
484ret: #2#1
485arg: #2#1 value, "Value to be clamped."
486arg: #2#1 min_value, "Lower bound, a scalar or matching vector."
487arg: #2#1 max_value, above(min_value), "High bound, must match the type of low."
488summary: Restrain a value to a range
489description:
490 Clamps a value to a specified high and low bound. clamp() returns min_value
491 if value &lt; min_value, max_value if value &gt; max_value, otherwise value.
492
493 There are two variants of clamp: one where the min and max are scalars applied
494 to all entries of the value, the other where the min and max are also vectors.
495
496 If min_value is greater than max_value, the results are undefined.
497end:
498
499function: clamp
500version: 9
501attrib: const
502w: 2, 3, 4
503t: f32
504ret: #2#1
505arg: #2#1 value
506arg: #2 min_value
507arg: #2 max_value, above(min_value)
508end:
509
510function: clamp
511version: 19
512attrib: const
513w: 1, 2, 3, 4
514t: u8, u16, u32, u64, i8, i16, i32, i64
515ret: #2#1
516arg: #2#1 value
517arg: #2#1 min_value
518arg: #2#1 max_value, above(min_value)
519end:
520
521function: clamp
522version: 19
523attrib: const
524w: 2, 3, 4
525t: u8, u16, u32, u64, i8, i16, i32, i64
526ret: #2#1
527arg: #2#1 value
528arg: #2 min_value
529arg: #2 max_value, above(min_value)
530end:
531
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800532function: clamp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800533version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800534attrib: const
535w: 1, 2, 3, 4
536t: f16
537ret: #2#1
538arg: #2#1 value
539arg: #2#1 min_value
540arg: #2#1 max_value, above(min_value)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800541end:
542
543function: clamp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800544version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800545attrib: const
546w: 2, 3, 4
547t: f16
548ret: #2#1
549arg: #2#1 value
550arg: #2 min_value
551arg: #2 max_value, above(min_value)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800552end:
553
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700554function: clz
555version: 9
556attrib: const
557w: 1, 2, 3, 4
558t: u8, u16, u32, i8, i16, i32
559ret: #2#1
560arg: #2#1 value
561summary: Number of leading 0 bits
562description:
563 Returns the number of leading 0-bits in a value.
564
565 For example, <code>clz((char)0x03)</code> returns 6.
566end:
567
568function: copysign
569version: 9
570attrib: const
571w: 1, 2, 3, 4
572t: f32
573ret: #2#1
574arg: #2#1 magnitude_value
575arg: #2#1 sign_value
576summary: Copies the sign of a number to another
577description:
578 Copies the sign from sign_value to magnitude_value.
579
580 The value returned is either magnitude_value or -magnitude_value.
581
582 For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
583end:
584
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800585function: copysign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800586version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800587attrib: const
588w: 1, 2, 3, 4
589t: f16
590ret: #2#1
591arg: #2#1 magnitude_value
592arg: #2#1 sign_value
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800593end:
594
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700595function: cos
596version: 9
597attrib: const
598w: 1, 2, 3, 4
599t: f32
600ret: #2#1
601arg: #2#1 v
602summary: Cosine
603description:
604 Returns the cosine of an angle measured in radians.
605
606 See also @native_cos().
607end:
608
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800609function: cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800610version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800611attrib: const
612w: 1, 2, 3, 4
613t: f16
614ret: #2#1
615arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800616end:
617
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700618function: cosh
619version: 9
620attrib: const
621w: 1, 2, 3, 4
622t: f32
623ret: #2#1
624arg: #2#1 v
625summary: Hypebolic cosine
626description:
627 Returns the hypebolic cosine of v, where v is measured in radians.
628
629 See also @native_cosh().
630end:
631
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800632function: cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800633version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800634attrib: const
635w: 1, 2, 3, 4
636t: f16
637ret: #2#1
638arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800639end:
640
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700641function: cospi
642version: 9
643attrib: const
644w: 1, 2, 3, 4
645t: f32
646ret: #2#1
647arg: #2#1 v
648summary: Cosine of a number multiplied by pi
649description:
650 Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
651
652 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
653
654 See also @native_cospi().
655end:
656
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800657function: cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800658version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800659attrib: const
660w: 1, 2, 3, 4
661t: f16
662ret: #2#1
663arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800664end:
665
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700666function: degrees
667version: 9
668attrib: const
669w: 1, 2, 3, 4
670t: f32
671ret: #2#1
672arg: #2#1 v
673summary: Converts radians into degrees
674description:
675 Converts from radians to degrees.
676end:
677
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800678function: degrees
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800679version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800680attrib: const
681w: 1, 2, 3, 4
682t: f16
683ret: #2#1
684arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800685end:
686
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700687function: erf
688version: 9
689attrib: const
690w: 1, 2, 3, 4
691t: f32
692ret: #2#1
693arg: #2#1 v
694summary: Mathematical error function
695description:
696 Returns the error function.
697end:
698
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800699function: erf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800700version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800701attrib: const
702w: 1, 2, 3, 4
703t: f16
704ret: #2#1
705arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800706end:
707
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700708function: erfc
709version: 9
710attrib: const
711w: 1, 2, 3, 4
712t: f32
713ret: #2#1
714arg: #2#1 v
715summary: Mathematical complementary error function
716description:
717 Returns the complementary error function.
718end:
719
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800720function: erfc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800721version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800722attrib: const
723w: 1, 2, 3, 4
724t: f16
725ret: #2#1
726arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800727end:
728
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700729function: exp
730version: 9
731attrib: const
732w: 1, 2, 3, 4
733t: f32
734ret: #2#1
735arg: #2#1 v
736summary: e raised to a number
737description:
738 Returns e raised to v, i.e. e ^ v.
739
740 See also @native_exp().
741end:
742
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800743function: exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800744version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800745attrib: const
746w: 1, 2, 3, 4
747t: f16
748ret: #2#1
749arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800750end:
751
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700752function: exp10
753version: 9
754attrib: const
755w: 1, 2, 3, 4
756t: f32
757ret: #2#1
758arg: #2#1 v
759summary: 10 raised to a number
760description:
761 Returns 10 raised to v, i.e. 10.f ^ v.
762
763 See also @native_exp10().
764end:
765
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800766function: exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800767version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800768attrib: const
769w: 1, 2, 3, 4
770t: f16
771ret: #2#1
772arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800773end:
774
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700775function: exp2
776version: 9
777attrib: const
778w: 1, 2, 3, 4
779t: f32
780ret: #2#1
781arg: #2#1 v
782summary: 2 raised to a number
783description:
784 Returns 2 raised to v, i.e. 2.f ^ v.
785
786 See also @native_exp2().
787end:
788
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800789function: exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800790version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800791attrib: const
792w: 1, 2, 3, 4
793t: f16
794ret: #2#1
795arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800796end:
797
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700798function: expm1
799version: 9
800attrib: const
801w: 1, 2, 3, 4
802t: f32
803ret: #2#1
804arg: #2#1 v
805summary: e raised to a number minus one
806description:
807 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
808
809 See also @native_expm1().
810end:
811
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800812function: expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800813version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800814attrib: const
815w: 1, 2, 3, 4
816t: f16
817ret: #2#1
818arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800819end:
820
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700821function: fabs
822version: 9
823attrib: const
824w: 1, 2, 3, 4
825t: f32
826ret: #2#1
827arg: #2#1 v
828summary: Absolute value of a float
829description:
830 Returns the absolute value of the float v.
831
832 For integers, use @abs().
833end:
834
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800835function: fabs
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800836version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800837attrib: const
838w: 1, 2, 3, 4
839t: f16
840ret: #2#1
841arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800842end:
843
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700844function: fdim
845version: 9
846attrib: const
847w: 1, 2, 3, 4
848t: f32
849ret: #2#1
850arg: #2#1 a
851arg: #2#1 b
852summary: Positive difference between two values
853description:
854 Returns the positive difference between two values.
855
856 If a &gt; b, returns (a - b) otherwise returns 0f.
857end:
858
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800859function: fdim
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800860version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800861attrib: const
862w: 1, 2, 3, 4
863t: f16
864ret: #2#1
865arg: #2#1 a
866arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800867end:
868
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700869function: floor
870version: 9
871attrib: const
872w: 1, 2, 3, 4
873t: f32
874ret: #2#1
875arg: #2#1 v
876summary: Smallest integer not greater than a value
877description:
878 Returns the smallest integer not greater than a value.
879
880 For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
881
882 See also @ceil().
883end:
884
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800885function: floor
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800886version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800887attrib: const
888w: 1, 2, 3, 4
889t: f16
890ret: #2#1
891arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800892end:
893
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700894function: fma
895version: 9
896attrib: const
897w: 1, 2, 3, 4
898t: f32
899ret: #2#1
900arg: #2#1 multiplicand1
901arg: #2#1 multiplicand2
902arg: #2#1 offset
903summary: Multiply and add
904description:
905 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
906
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700907 This function is similar to @mad(). fma() retains full precision of the multiplied result
908 and rounds only after the addition. @mad() rounds after the multiplication and the addition.
909 This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700910end:
911
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800912function: fma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800913version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800914attrib: const
915w: 1, 2, 3, 4
916t: f16
917ret: #2#1
918arg: #2#1 multiplicand1
919arg: #2#1 multiplicand2
920arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800921end:
922
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700923function: fmax
924version: 9
925attrib: const
926w: 1, 2, 3, 4
927t: f32
928ret: #2#1
929arg: #2#1 a
930arg: #2#1 b
931summary: Maximum of two floats
932description:
933 Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
934
935 The @max() function returns identical results but can be applied to more data types.
936end:
937
938function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800939version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800940attrib: const
941w: 1, 2, 3, 4
942t: f16
943ret: #2#1
944arg: #2#1 a
945arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800946end:
947
948function: fmax
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700949version: 9
950attrib: const
951w: 2, 3, 4
952t: f32
953ret: #2#1
954arg: #2#1 a
955arg: #2 b
956end:
957
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800958function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800959version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800960attrib: const
961w: 2, 3, 4
962t: f16
963ret: #2#1
964arg: #2#1 a
965arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800966end:
967
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700968function: fmin
969version: 9
970attrib: const
971w: 1, 2, 3, 4
972t: f32
973ret: #2#1
974arg: #2#1 a
975arg: #2#1 b
976summary: Minimum of two floats
977description:
978 Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
979
980 The @min() function returns identical results but can be applied to more data types.
981end:
982
983function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800984version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800985attrib: const
986w: 1, 2, 3, 4
987t: f16
988ret: #2#1
989arg: #2#1 a
990arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800991end:
992
993function: fmin
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700994version: 9
995attrib: const
996w: 2, 3, 4
997t: f32
998ret: #2#1
999arg: #2#1 a
1000arg: #2 b
1001end:
1002
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001003function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001004version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001005attrib: const
1006w: 2, 3, 4
1007t: f16
1008ret: #2#1
1009arg: #2#1 a
1010arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001011end:
1012
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001013function: fmod
1014version: 9
1015attrib: const
1016w: 1, 2, 3, 4
1017t: f32
1018ret: #2#1
1019arg: #2#1 numerator
1020arg: #2#1 denominator
1021summary: Modulo
1022description:
1023 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1024
1025 The function @remainder() is similar but rounds toward the closest interger.
1026 For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
1027 while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
1028end:
1029
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001030function: fmod
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001031version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001032attrib: const
1033w: 1, 2, 3, 4
1034t: f16
1035ret: #2#1
1036arg: #2#1 numerator
1037arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001038end:
1039
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001040function: fract
1041version: 9
1042w: 1, 2, 3, 4
1043t: f32
1044ret: #2#1
1045arg: #2#1 v, "Input value."
1046arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
1047summary: Positive fractional part
1048description:
1049 Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
1050
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001051 For example, <code>fract(1.3f, &amp;val)</code> returns 0.3f and sets val to 1.f.
1052 <code>fract(-1.3f, &amp;val)</code> returns 0.7f and sets val to -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001053end:
1054
1055function: fract
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001056version: 9 23
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001057attrib: const
1058w: 1, 2, 3, 4
1059t: f32
1060ret: #2#1
1061arg: #2#1 v
1062inline:
1063 #2#1 unused;
1064 return fract(v, &unused);
1065end:
1066
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001067function: fract
1068version: 24
1069w: 1, 2, 3, 4
1070t: f32
1071ret: #2#1
1072arg: #2#1 v
1073end:
1074
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001075function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001076version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001077w: 1, 2, 3, 4
1078t: f16
1079ret: #2#1
1080arg: #2#1 v
1081arg: #2#1* floor
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001082end:
1083
1084function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001085version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001086w: 1, 2, 3, 4
1087t: f16
1088ret: #2#1
1089arg: #2#1 v
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001090end:
1091
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001092function: frexp
1093version: 9
1094w: 1, 2, 3, 4
1095t: f32
1096ret: #2#1
1097arg: #2#1 v, "Input value."
1098arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1099summary: Binary mantissa and exponent
1100description:
1101 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1102
1103 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1104
1105 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1106end:
1107
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001108function: frexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001109version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001110w: 1, 2, 3, 4
1111t: f16
1112ret: #2#1
1113arg: #2#1 v
1114arg: int#1* exponent
1115test: none
1116end:
1117
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001118function: half_recip
1119version: 17
1120attrib: const
1121w: 1, 2, 3, 4
1122t: f32
1123ret: #2#1
1124arg: #2#1 v
1125summary: Reciprocal computed to 16 bit precision
1126description:
1127 Returns the approximate reciprocal of a value.
1128
1129 The precision is that of a 16 bit floating point value.
1130
1131 See also @native_recip().
1132end:
1133
1134function: half_rsqrt
1135version: 17
1136attrib: const
1137w: 1, 2, 3, 4
1138t: f32
1139ret: #2#1
1140arg: #2#1 v
1141summary: Reciprocal of a square root computed to 16 bit precision
1142description:
1143 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1144
1145 The precision is that of a 16 bit floating point value.
1146
1147 See also @rsqrt(), @native_rsqrt().
1148end:
1149
1150function: half_sqrt
1151version: 17
1152attrib: const
1153w: 1, 2, 3, 4
1154t: f32
1155ret: #2#1
1156arg: #2#1 v
1157summary: Square root computed to 16 bit precision
1158description:
1159 Returns the approximate square root of a value.
1160
1161 The precision is that of a 16 bit floating point value.
1162
1163 See also @sqrt(), @native_sqrt().
1164end:
1165
1166function: hypot
1167version: 9
1168attrib: const
1169w: 1, 2, 3, 4
1170t: f32
1171ret: #2#1
1172arg: #2#1 a
1173arg: #2#1 b
1174summary: Hypotenuse
1175description:
1176 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1177
1178 See also @native_hypot().
1179end:
1180
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001181function: hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001182version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001183attrib: const
1184w: 1, 2, 3, 4
1185t: f16
1186ret: #2#1
1187arg: #2#1 a
1188arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001189end:
1190
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001191function: ilogb
1192version: 9
1193attrib: const
1194w: 1, 2, 3, 4
1195t: f32
1196ret: int#1
1197arg: float#1 v
1198summary: Base two exponent
1199description:
1200 Returns the base two exponent of a value, where the mantissa is between
1201 1.f (inclusive) and 2.f (exclusive).
1202
1203 For example, <code>ilogb(8.5f)</code> returns 3.
1204
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001205 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001206
1207 @logb() is similar but returns a float.
1208test: custom
1209end:
1210
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001211function: ilogb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001212version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001213attrib: const
1214w: 1, 2, 3, 4
1215t: f16
1216ret: int#1
1217arg: half#1 v
1218test: none
1219end:
1220
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001221function: ldexp
1222version: 9
1223attrib: const
1224w: 1, 2, 3, 4
1225ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001226arg: float#1 mantissa, "Mantissa."
1227arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001228summary: Creates a floating point from mantissa and exponent
1229description:
1230 Returns the floating point created from the mantissa and exponent,
1231 i.e. (mantissa * 2 ^ exponent).
1232
1233 See @frexp() for the reverse operation.
1234end:
1235
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001236function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001237version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001238attrib: const
1239w: 1, 2, 3, 4
1240ret: half#1
1241arg: half#1 mantissa
1242arg: int#1 exponent
1243test: none
1244end:
1245
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001246function: ldexp
1247version: 9
1248attrib: const
1249w: 2, 3, 4
1250ret: float#1
1251arg: float#1 mantissa
1252arg: int exponent
1253end:
1254
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001255function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001256version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001257attrib: const
1258w: 2, 3, 4
1259ret: half#1
1260arg: half#1 mantissa
1261arg: int exponent
1262test: none
1263end:
1264
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001265function: lgamma
1266version: 9
1267attrib: const
1268w: 1, 2, 3, 4
1269t: f32
1270ret: #2#1
1271arg: #2#1 v
1272summary: Natural logarithm of the gamma function
1273description:
1274 Returns the natural logarithm of the absolute value of the gamma function,
1275 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1276
1277 See also @tgamma().
1278end:
1279
1280function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001281version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001282attrib: const
1283w: 1, 2, 3, 4
1284t: f16
1285ret: #2#1
1286arg: #2#1 v
1287test: none
1288end:
1289
1290function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001291version: 9
1292w: 1, 2, 3, 4
1293t: f32
1294ret: #2#1
1295arg: #2#1 v
1296arg: int#1* sign_of_gamma, "If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f."
1297test: custom
1298#TODO Temporary until bionic & associated drivers are fixed
1299end:
1300
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001301function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001302version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001303w: 1, 2, 3, 4
1304t: f16
1305ret: #2#1
1306arg: #2#1 v
1307arg: int#1* sign_of_gamma
1308test: none
1309end:
1310
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001311function: log
1312version: 9
1313attrib: const
1314w: 1, 2, 3, 4
1315t: f32
1316ret: #2#1
1317arg: #2#1 v
1318summary: Natural logarithm
1319description:
1320 Returns the natural logarithm.
1321
1322 See also @native_log().
1323end:
1324
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001325function: log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001326version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001327attrib: const
1328w: 1, 2, 3, 4
1329t: f16
1330ret: #2#1
1331arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001332end:
1333
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001334function: log10
1335version: 9
1336attrib: const
1337w: 1, 2, 3, 4
1338t: f32
1339ret: #2#1
1340arg: #2#1 v
1341summary: Base 10 logarithm
1342description:
1343 Returns the base 10 logarithm.
1344
1345 See also @native_log10().
1346end:
1347
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001348function: log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001349version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001350attrib: const
1351w: 1, 2, 3, 4
1352t: f16
1353ret: #2#1
1354arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001355end:
1356
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001357function: log1p
1358version: 9
1359attrib: const
1360w: 1, 2, 3, 4
1361t: f32
1362ret: #2#1
1363arg: #2#1 v
1364summary: Natural logarithm of a value plus 1
1365description:
1366 Returns the natural logarithm of <code>(v + 1.f)</code>.
1367
1368 See also @native_log1p().
1369end:
1370
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001371function: log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001372version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001373attrib: const
1374w: 1, 2, 3, 4
1375t: f16
1376ret: #2#1
1377arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001378end:
1379
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001380function: log2
1381version: 9
1382attrib: const
1383w: 1, 2, 3, 4
1384t: f32
1385ret: #2#1
1386arg: #2#1 v
1387summary: Base 2 logarithm
1388description:
1389 Returns the base 2 logarithm.
1390
1391 See also @native_log2().
1392end:
1393
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001394function: log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001395version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001396attrib: const
1397w: 1, 2, 3, 4
1398t: f16
1399ret: #2#1
1400arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001401end:
1402
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001403function: logb
1404version: 9
1405attrib: const
1406w: 1, 2, 3, 4
1407t: f32
1408ret: #2#1
1409arg: #2#1 v
1410summary: Base two exponent
1411description:
1412 Returns the base two exponent of a value, where the mantissa is between
1413 1.f (inclusive) and 2.f (exclusive).
1414
1415 For example, <code>logb(8.5f)</code> returns 3.f.
1416
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001417 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001418
1419 @ilogb() is similar but returns an integer.
1420end:
1421
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001422function: logb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001423version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001424attrib: const
1425w: 1, 2, 3, 4
1426t: f16
1427ret: #2#1
1428arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001429end:
1430
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001431function: mad
1432version: 9
1433attrib: const
1434w: 1, 2, 3, 4
1435t: f32
1436ret: #2#1
1437arg: #2#1 multiplicand1
1438arg: #2#1 multiplicand2
1439arg: #2#1 offset
1440summary: Multiply and add
1441description:
1442 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1443
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001444 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1445 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1446 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001447end:
1448
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001449function: mad
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001450version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001451attrib: const
1452w: 1, 2, 3, 4
1453t: f16
1454ret: #2#1
1455arg: #2#1 multiplicand1
1456arg: #2#1 multiplicand2
1457arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001458end:
1459
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001460function: max
1461version: 9
1462attrib: const
1463w: 1, 2, 3, 4
1464t: f32
1465ret: #2#1
1466arg: #2#1 a
1467arg: #2#1 b
1468summary: Maximum
1469description:
1470 Returns the maximum value of two arguments.
1471end:
1472
1473function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001474version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001475attrib: const
1476w: 1, 2, 3, 4
1477t: f16
1478ret: #2#1
1479arg: #2#1 a
1480arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001481end:
1482
1483function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001484version: 9
1485attrib: const
1486w: 2, 3, 4
1487t: f32
1488ret: #2#1
1489arg: #2#1 a
1490arg: #2 b
1491end:
1492
1493function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001494version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001495attrib: const
1496w: 2, 3, 4
1497t: f16
1498ret: #2#1
1499arg: #2#1 a
1500arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001501end:
1502
1503function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001504version: 9 20
1505attrib: const
1506w: 1
1507t: i8, i16, i32, u8, u16, u32
1508ret: #2#1
1509arg: #2#1 a
1510arg: #2#1 b
1511inline:
1512 return (a > b ? a : b);
1513end:
1514
1515function: max
1516version: 9 20
1517attrib: const
1518w: 2
1519t: i8, i16, i32, u8, u16, u32
1520ret: #2#1
1521arg: #2#1 a
1522arg: #2#1 b
1523inline:
1524 #2#1 tmp;
1525 tmp.x = (a.x > b.x ? a.x : b.x);
1526 tmp.y = (a.y > b.y ? a.y : b.y);
1527 return tmp;
1528end:
1529
1530function: max
1531version: 9 20
1532attrib: const
1533w: 3
1534t: i8, i16, i32, u8, u16, u32
1535ret: #2#1
1536arg: #2#1 a
1537arg: #2#1 b
1538inline:
1539 #2#1 tmp;
1540 tmp.x = (a.x > b.x ? a.x : b.x);
1541 tmp.y = (a.y > b.y ? a.y : b.y);
1542 tmp.z = (a.z > b.z ? a.z : b.z);
1543 return tmp;
1544end:
1545
1546function: max
1547version: 9 20
1548attrib: const
1549w: 4
1550t: i8, i16, i32, u8, u16, u32
1551ret: #2#1
1552arg: #2#1 a
1553arg: #2#1 b
1554inline:
1555 #2#1 tmp;
1556 tmp.x = (a.x > b.x ? a.x : b.x);
1557 tmp.y = (a.y > b.y ? a.y : b.y);
1558 tmp.z = (a.z > b.z ? a.z : b.z);
1559 tmp.w = (a.w > b.w ? a.w : b.w);
1560 return tmp;
1561end:
1562
1563function: max
1564version: 21
1565attrib: const
1566w: 1, 2, 3, 4
1567t: i8, i16, i32, i64, u8, u16, u32, u64
1568ret: #2#1
1569arg: #2#1 a
1570arg: #2#1 b
1571end:
1572
1573function: min
1574version: 9
1575attrib: const
1576w: 1, 2, 3, 4
1577t: f32
1578ret: #2#1
1579arg: #2#1 a
1580arg: #2#1 b
1581summary: Minimum
1582description:
1583 Returns the minimum value of two arguments.
1584end:
1585
1586function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001587version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001588attrib: const
1589w: 1, 2, 3, 4
1590t: f16
1591ret: #2#1
1592arg: #2#1 a
1593arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001594end:
1595
1596function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001597version: 9
1598attrib: const
1599w: 2, 3, 4
1600t: f32
1601ret: #2#1
1602arg: #2#1 a
1603arg: #2 b
1604end:
1605
1606function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001607version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001608attrib: const
1609w: 2, 3, 4
1610t: f16
1611ret: #2#1
1612arg: #2#1 a
1613arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001614end:
1615
1616function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001617version: 9 20
1618attrib: const
1619w: 1
1620t: i8, i16, i32, u8, u16, u32
1621ret: #2#1
1622arg: #2#1 a
1623arg: #2#1 b
1624inline:
1625 return (a < b ? a : b);
1626end:
1627
1628function: min
1629version: 9 20
1630attrib: const
1631w: 2
1632t: i8, i16, i32, u8, u16, u32
1633ret: #2#1
1634arg: #2#1 a
1635arg: #2#1 b
1636inline:
1637 #2#1 tmp;
1638 tmp.x = (a.x < b.x ? a.x : b.x);
1639 tmp.y = (a.y < b.y ? a.y : b.y);
1640 return tmp;
1641end:
1642
1643function: min
1644version: 9 20
1645attrib: const
1646w: 3
1647t: i8, i16, i32, u8, u16, u32
1648ret: #2#1
1649arg: #2#1 a
1650arg: #2#1 b
1651inline:
1652 #2#1 tmp;
1653 tmp.x = (a.x < b.x ? a.x : b.x);
1654 tmp.y = (a.y < b.y ? a.y : b.y);
1655 tmp.z = (a.z < b.z ? a.z : b.z);
1656 return tmp;
1657end:
1658
1659function: min
1660version: 9 20
1661attrib: const
1662w: 4
1663t: i8, i16, i32, u8, u16, u32
1664ret: #2#1
1665arg: #2#1 a
1666arg: #2#1 b
1667inline:
1668 #2#1 tmp;
1669 tmp.x = (a.x < b.x ? a.x : b.x);
1670 tmp.y = (a.y < b.y ? a.y : b.y);
1671 tmp.z = (a.z < b.z ? a.z : b.z);
1672 tmp.w = (a.w < b.w ? a.w : b.w);
1673 return tmp;
1674end:
1675
1676function: min
1677version: 21
1678attrib: const
1679w: 1, 2, 3, 4
1680t: i8, i16, i32, i64, u8, u16, u32, u64
1681ret: #2#1
1682arg: #2#1 a
1683arg: #2#1 b
1684end:
1685
1686function: mix
1687version: 9
1688attrib: const
1689w: 1, 2, 3, 4
1690t: f32
1691ret: #2#1
1692arg: #2#1 start
1693arg: #2#1 stop
1694arg: #2#1 fraction
1695summary: Mixes two values
1696description:
1697 Returns start + ((stop - start) * fraction).
1698
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001699 This can be useful for mixing two values. For example, to create a new color that is
1700 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001701end:
1702
1703function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001704version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001705attrib: const
1706w: 1, 2, 3, 4
1707t: f16
1708ret: #2#1
1709arg: #2#1 start
1710arg: #2#1 stop
1711arg: #2#1 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001712end:
1713
1714function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001715version: 9
1716attrib: const
1717w: 2, 3, 4
1718t: f32
1719ret: #2#1
1720arg: #2#1 start
1721arg: #2#1 stop
1722arg: #2 fraction
1723end:
1724
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001725function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001726version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001727attrib: const
1728w: 2, 3, 4
1729t: f16
1730ret: #2#1
1731arg: #2#1 start
1732arg: #2#1 stop
1733arg: #2 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001734end:
1735
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001736function: modf
1737version: 9
1738w: 1, 2, 3, 4
1739t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001740ret: #2#1, "Floating point portion of the value."
1741arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001742arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1743summary: Integral and fractional components
1744description:
1745 Returns the integral and fractional components of a number.
1746
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001747 Both components will have the same sign as x. For example, for an input of -3.72f,
Pirama Arumuga Nainare6128ff2015-12-06 17:32:42 -08001748 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001749end:
1750
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001751function: modf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001752version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001753w: 1, 2, 3, 4
1754t: f16
1755ret: #2#1
1756arg: #2#1 v
1757arg: #2#1* integral_part
1758test: none
1759end:
1760
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001761function: nan
1762version: 9
1763attrib: const
1764w: 1
1765t: f32
1766ret: #2#1
1767arg: uint#1 v, "Not used."
1768#TODO We're not using the argument. Once we do, add this documentation line:
1769# The argument is embedded into the return value and can be used to distinguish various NaNs.
1770summary: Not a Number
1771description:
1772 Returns a NaN value (Not a Number).
1773end:
1774
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001775function: nan_half
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001776version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001777attrib: const
1778t: f16
1779ret: #1
1780summary: Not a Number
1781description:
1782 Returns a half-precision floating point NaN value (Not a Number).
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001783end:
1784
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001785function: native_acos
1786version: 21
1787attrib: const
1788w: 1, 2, 3, 4
1789t: f32
1790ret: #2#1
1791arg: #2#1 v, range(-1,1)
1792summary: Approximate inverse cosine
1793description:
1794 Returns the approximate inverse cosine, in radians.
1795
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001796 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001797
1798 See also @acos().
1799# TODO Temporary
1800test: limited(0.0005)
1801end:
1802
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001803function: native_acos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001804version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001805attrib: const
1806w: 1, 2, 3, 4
1807t: f16
1808ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001809arg: #2#1 v, range(-1,1)
1810# Absolute error of 2^-11, i.e. 0.00048828125
1811test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001812end:
1813
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001814function: native_acosh
1815version: 21
1816attrib: const
1817w: 1, 2, 3, 4
1818t: f32
1819ret: #2#1
1820arg: #2#1 v
1821summary: Approximate inverse hyperbolic cosine
1822description:
1823 Returns the approximate inverse hyperbolic cosine, in radians.
1824
1825 See also @acosh().
1826# TODO Temporary
1827test: limited(0.0005)
1828end:
1829
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001830function: native_acosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001831version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001832attrib: const
1833w: 1, 2, 3, 4
1834t: f16
1835ret: #2#1
1836arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001837end:
1838
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001839function: native_acospi
1840version: 21
1841attrib: const
1842w: 1, 2, 3, 4
1843t: f32
1844ret: #2#1
1845arg: #2#1 v, range(-1,1)
1846summary: Approximate inverse cosine divided by pi
1847description:
1848 Returns the approximate inverse cosine in radians, divided by pi.
1849
1850 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1851
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001852 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001853
1854 See also @acospi().
1855# TODO Temporary
1856test: limited(0.0005)
1857end:
1858
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001859function: native_acospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001860version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001861attrib: const
1862w: 1, 2, 3, 4
1863t: f16
1864ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001865arg: #2#1 v, range(-1,1)
1866# Absolute error of 2^-11, i.e. 0.00048828125
1867test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001868end:
1869
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001870function: native_asin
1871version: 21
1872attrib: const
1873w: 1, 2, 3, 4
1874t: f32
1875ret: #2#1
1876arg: #2#1 v, range(-1,1)
1877summary: Approximate inverse sine
1878description:
1879 Returns the approximate inverse sine, in radians.
1880
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001881 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001882
1883 See also @asin().
1884# TODO Temporary
1885test: limited(0.0005)
1886end:
1887
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001888function: native_asin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001889version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001890attrib: const
1891w: 1, 2, 3, 4
1892t: f16
1893ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001894arg: #2#1 v, range(-1,1)
1895# Absolute error of 2^-11, i.e. 0.00048828125
1896test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001897end:
1898
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001899function: native_asinh
1900version: 21
1901attrib: const
1902w: 1, 2, 3, 4
1903t: f32
1904ret: #2#1
1905arg: #2#1 v
1906summary: Approximate inverse hyperbolic sine
1907description:
1908 Returns the approximate inverse hyperbolic sine, in radians.
1909
1910 See also @asinh().
1911# TODO Temporary
1912test: limited(0.0005)
1913end:
1914
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001915function: native_asinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001916version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001917attrib: const
1918w: 1, 2, 3, 4
1919t: f16
1920ret: #2#1
1921arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001922end:
1923
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001924function: native_asinpi
1925version: 21
1926attrib: const
1927w: 1, 2, 3, 4
1928t: f32
1929ret: #2#1
1930arg: #2#1 v, range(-1,1)
1931summary: Approximate inverse sine divided by pi
1932description:
1933 Returns the approximate inverse sine in radians, divided by pi.
1934
1935 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1936
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001937 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001938
1939 See also @asinpi().
1940# TODO Temporary
1941test: limited(0.0005)
1942end:
1943
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001944function: native_asinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001945version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001946attrib: const
1947w: 1, 2, 3, 4
1948t: f16
1949ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001950arg: #2#1 v, range(-1,1)
1951# Absolute error of 2^-11, i.e. 0.00048828125
1952test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001953end:
1954
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001955function: native_atan
1956version: 21
1957attrib: const
1958w: 1, 2, 3, 4
1959t: f32
1960ret: #2#1
1961arg: #2#1 v, range(-1,1)
1962summary: Approximate inverse tangent
1963description:
1964 Returns the approximate inverse tangent, in radians.
1965
1966 See also @atan().
1967# TODO Temporary
1968test: limited(0.0005)
1969end:
1970
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001971function: native_atan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001972version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001973attrib: const
1974w: 1, 2, 3, 4
1975t: f16
1976ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07001977arg: #2#1 v, range(-1, 1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001978end:
1979
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001980function: native_atan2
1981version: 21
1982attrib: const
1983w: 1, 2, 3, 4
1984t: f32
1985ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001986arg: #2#1 numerator, "Numerator."
1987arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001988summary: Approximate inverse tangent of a ratio
1989description:
1990 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
1991
1992 See also @atan2().
1993# TODO Temporary
1994test: limited(0.0005)
1995end:
1996
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001997function: native_atan2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001998version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001999attrib: const
2000w: 1, 2, 3, 4
2001t: f16
2002ret: #2#1
2003arg: #2#1 numerator
2004arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002005end:
2006
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002007function: native_atan2pi
2008version: 21
2009attrib: const
2010w: 1, 2, 3, 4
2011t: f32
2012ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002013arg: #2#1 numerator, "Numerator."
2014arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002015summary: Approximate inverse tangent of a ratio, divided by pi
2016description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002017 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2018 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002019
2020 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2021
2022 See also @atan2pi().
2023# TODO Temporary
2024test: limited(0.0005)
2025end:
2026
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002027function: native_atan2pi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002028version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002029attrib: const
2030w: 1, 2, 3, 4
2031t: f16
2032ret: #2#1
2033arg: #2#1 numerator
2034arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002035end:
2036
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002037function: native_atanh
2038version: 21
2039attrib: const
2040w: 1, 2, 3, 4
2041t: f32
2042ret: #2#1
2043arg: #2#1 v, range(-1,1)
2044summary: Approximate inverse hyperbolic tangent
2045description:
2046 Returns the approximate inverse hyperbolic tangent, in radians.
2047
2048 See also @atanh().
2049# TODO Temporary
2050test: limited(0.0005)
2051end:
2052
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002053function: native_atanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002054version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002055attrib: const
2056w: 1, 2, 3, 4
2057t: f16
2058ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002059arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002060end:
2061
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002062function: native_atanpi
2063version: 21
2064attrib: const
2065w: 1, 2, 3, 4
2066t: f32
2067ret: #2#1
2068arg: #2#1 v, range(-1,1)
2069summary: Approximate inverse tangent divided by pi
2070description:
2071 Returns the approximate inverse tangent in radians, divided by pi.
2072
2073 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2074
2075 See also @atanpi().
2076# TODO Temporary
2077test: limited(0.0005)
2078end:
2079
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002080function: native_atanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002081version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002082attrib: const
2083w: 1, 2, 3, 4
2084t: f16
2085ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002086arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002087end:
2088
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002089function: native_cbrt
2090version: 21
2091attrib: const
2092w: 1, 2, 3, 4
2093t: f32
2094ret: #2#1
2095arg: #2#1 v
2096summary: Approximate cube root
2097description:
2098 Returns the approximate cubic root.
2099
2100 See also @cbrt().
2101end:
2102
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002103function: native_cbrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002104version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002105attrib: const
2106w: 1, 2, 3, 4
2107t: f16
2108ret: #2#1
2109arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002110end:
2111
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002112function: native_cos
2113version: 21
2114attrib: const
2115w: 1, 2, 3, 4
2116t: f32
2117ret: #2#1
2118arg: #2#1 v
2119summary: Approximate cosine
2120description:
2121 Returns the approximate cosine of an angle measured in radians.
2122
2123 See also @cos().
2124end:
2125
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002126function: native_cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002127version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002128attrib: const
2129w: 1, 2, 3, 4
2130t: f16
2131ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002132arg: #2#1 v, range(-314,314)
2133# Absolute error of 2^-11, i.e. 0.00048828125
2134test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002135end:
2136
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002137function: native_cosh
2138version: 21
2139attrib: const
2140w: 1, 2, 3, 4
2141t: f32
2142ret: #2#1
2143arg: #2#1 v
2144summary: Approximate hypebolic cosine
2145description:
2146 Returns the approximate hypebolic cosine.
2147
2148 See also @cosh().
2149end:
2150
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002151function: native_cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002152version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002153attrib: const
2154w: 1, 2, 3, 4
2155t: f16
2156ret: #2#1
2157arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002158end:
2159
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002160function: native_cospi
2161version: 21
2162attrib: const
2163w: 1, 2, 3, 4
2164t: f32
2165ret: #2#1
2166arg: #2#1 v
2167summary: Approximate cosine of a number multiplied by pi
2168description:
2169 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2170
2171 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2172
2173 See also @cospi().
2174end:
2175
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002176function: native_cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002177version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002178attrib: const
2179w: 1, 2, 3, 4
2180t: f16
2181ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002182arg: #2#1 v, range(-100,100)
2183# Absolute error of 2^-11, i.e. 0.00048828125
2184test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002185end:
2186
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002187function: native_divide
2188version: 21
2189attrib: const
2190w: 1, 2, 3, 4
2191t: f32
2192ret: #2#1
2193arg: #2#1 left_vector
2194arg: #2#1 right_vector
2195summary: Approximate division
2196description:
2197 Computes the approximate division of two values.
2198end:
2199
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002200function: native_divide
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002201version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002202attrib: const
2203w: 1, 2, 3, 4
2204t: f16
2205ret: #2#1
2206arg: #2#1 left_vector
2207arg: #2#1 right_vector
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002208end:
2209
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002210function: native_exp
2211version: 18
2212attrib: const
2213w: 1, 2, 3, 4
2214t: f32
2215ret: #2#1
2216arg: #2#1 v, range(-86,86)
2217summary: Approximate e raised to a number
2218description:
2219 Fast approximate exp.
2220
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002221 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2222 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002223
2224 See also @exp().
2225test: limited
2226end:
2227
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002228function: native_exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002229version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002230attrib: const
2231w: 1, 2, 3, 4
2232t: f16
2233ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002234arg: #2#1 v, range(-86,86)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002235end:
2236
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002237function: native_exp10
2238version: 18
2239attrib: const
2240w: 1, 2, 3, 4
2241t: f32
2242ret: #2#1
2243arg: #2#1 v, range(-37,37)
2244summary: Approximate 10 raised to a number
2245description:
2246 Fast approximate exp10.
2247
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002248 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2249 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002250
2251 See also @exp10().
2252test: limited
2253end:
2254
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002255function: native_exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002256version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002257attrib: const
2258w: 1, 2, 3, 4
2259t: f16
2260ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002261arg: #2#1 v, range(-37,37)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002262end:
2263
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002264function: native_exp2
2265version: 18
2266attrib: const
2267w: 1, 2, 3, 4
2268t: f32
2269ret: #2#1
2270arg: #2#1 v, range(-125,125)
2271summary: Approximate 2 raised to a number
2272description:
2273 Fast approximate exp2.
2274
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002275 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2276 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002277
2278 See also @exp2().
2279test: limited
2280end:
2281
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002282function: native_exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002283version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002284attrib: const
2285w: 1, 2, 3, 4
2286t: f16
2287ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002288arg: #2#1 v, range(-125,125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002289end:
2290
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002291function: native_expm1
2292version: 21
2293attrib: const
2294w: 1, 2, 3, 4
2295t: f32
2296ret: #2#1
2297arg: #2#1 v
2298summary: Approximate e raised to a number minus one
2299description:
2300 Returns the approximate (e ^ v) - 1.
2301
2302 See also @expm1().
2303end:
2304
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002305function: native_expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002306version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002307attrib: const
2308w: 1, 2, 3, 4
2309t: f16
2310ret: #2#1
2311arg: #2#1 v
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002312test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002313end:
2314
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002315function: native_hypot
2316version: 21
2317attrib: const
2318w: 1, 2, 3, 4
2319t: f32
2320ret: #2#1
2321arg: #2#1 a
2322arg: #2#1 b
2323summary: Approximate hypotenuse
2324description:
2325 Returns the approximate native_sqrt(a * a + b * b)
2326
2327 See also @hypot().
2328end:
2329
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002330function: native_hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002331version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002332attrib: const
2333w: 1, 2, 3, 4
2334t: f16
2335ret: #2#1
2336arg: #2#1 a
2337arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002338end:
2339
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002340function: native_log
2341version: 18
2342attrib: const
2343w: 1, 2, 3, 4
2344t: f32
2345ret: #2#1
2346arg: #2#1 v, range(10e-10,10e10)
2347summary: Approximate natural logarithm
2348description:
2349 Fast approximate log.
2350
2351 It is not accurate for values very close to zero.
2352
2353 See also @log().
2354test: limited
2355end:
2356
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002357function: native_log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002358version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002359attrib: const
2360w: 1, 2, 3, 4
2361t: f16
2362ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002363arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002364end:
2365
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002366function: native_log10
2367version: 18
2368attrib: const
2369w: 1, 2, 3, 4
2370t: f32
2371ret: #2#1
2372arg: #2#1 v, range(10e-10,10e10)
2373summary: Approximate base 10 logarithm
2374description:
2375 Fast approximate log10.
2376
2377 It is not accurate for values very close to zero.
2378
2379 See also @log10().
2380test: limited
2381end:
2382
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002383function: native_log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002384version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002385attrib: const
2386w: 1, 2, 3, 4
2387t: f16
2388ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002389arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002390end:
2391
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002392function: native_log1p
2393version: 21
2394attrib: const
2395w: 1, 2, 3, 4
2396t: f32
2397ret: #2#1
2398arg: #2#1 v
2399summary: Approximate natural logarithm of a value plus 1
2400description:
2401 Returns the approximate natural logarithm of (v + 1.0f)
2402
2403 See also @log1p().
2404end:
2405
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002406function: native_log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002407version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002408attrib: const
2409w: 1, 2, 3, 4
2410t: f16
2411ret: #2#1
2412arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002413end:
2414
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002415function: native_log2
2416version: 18
2417attrib: const
2418w: 1, 2, 3, 4
2419t: f32
2420ret: #2#1
2421arg: #2#1 v, range(10e-10,10e10)
2422summary: Approximate base 2 logarithm
2423description:
2424 Fast approximate log2.
2425
2426 It is not accurate for values very close to zero.
2427
2428 See also @log2().
2429test: limited
2430end:
2431
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002432function: native_log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002433version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002434attrib: const
2435w: 1, 2, 3, 4
2436t: f16
2437ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002438arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002439end:
2440
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002441function: native_powr
2442version: 18
2443attrib: const
2444w: 1, 2, 3, 4
2445t: f32
2446ret: #2#1
2447arg: #2#1 base, range(0,256), "Must be between 0.f and 256.f. The function is not accurate for values very close to zero."
2448arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2449summary: Approximate positive base raised to an exponent
2450description:
2451 Fast approximate (base ^ exponent).
2452
2453 See also @powr().
2454test: limited
2455end:
2456
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002457function: native_powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002458version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002459attrib: const
2460w: 1, 2, 3, 4
2461t: f16
2462ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002463arg: #2#1 base, range(0,256)
2464arg: #2#1 exponent, range(-15,15)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002465end:
2466
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002467function: native_recip
2468version: 21
2469attrib: const
2470w: 1, 2, 3, 4
2471t: f32
2472ret: #2#1
2473arg: #2#1 v
2474summary: Approximate reciprocal
2475description:
2476 Returns the approximate approximate reciprocal of a value.
2477
2478 See also @half_recip().
2479end:
2480
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002481function: native_recip
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002482version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002483attrib: const
2484w: 1, 2, 3, 4
2485t: f16
2486ret: #2#1
2487arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002488end:
2489
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002490function: native_rootn
2491version: 21
2492attrib: const
2493w: 1, 2, 3, 4
2494t: f32
2495ret: #2#1
2496arg: #2#1 v
2497arg: int#1 n
2498summary: Approximate nth root
2499description:
2500 Compute the approximate Nth root of a value.
2501
2502 See also @rootn().
2503end:
2504
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002505function: native_rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002506version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002507attrib: const
2508w: 1, 2, 3, 4
2509t: f16
2510ret: #2#1
2511arg: #2#1 v
2512arg: int#1 n
2513test: none
2514end:
2515
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002516function: native_rsqrt
2517version: 21
2518attrib: const
2519w: 1, 2, 3, 4
2520t: f32
2521ret: #2#1
2522arg: #2#1 v
2523summary: Approximate reciprocal of a square root
2524description:
2525 Returns approximate (1 / sqrt(v)).
2526
2527 See also @rsqrt(), @half_rsqrt().
2528end:
2529
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002530function: native_rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002531version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002532attrib: const
2533w: 1, 2, 3, 4
2534t: f16
2535ret: #2#1
2536arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002537end:
2538
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002539function: native_sin
2540version: 21
2541attrib: const
2542w: 1, 2, 3, 4
2543t: f32
2544ret: #2#1
2545arg: #2#1 v
2546summary: Approximate sine
2547description:
2548 Returns the approximate sine of an angle measured in radians.
2549
2550 See also @sin().
2551end:
2552
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002553function: native_sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002554version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002555attrib: const
2556w: 1, 2, 3, 4
2557t: f16
2558ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002559arg: #2#1 v, range(-314,314)
2560# Absolute error of 2^-11, i.e. 0.00048828125
2561test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002562end:
2563
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002564function: native_sincos
2565version: 21
2566w: 1, 2, 3, 4
2567t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002568ret: #2#1, "Sine."
2569arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002570arg: #2#1* cos, "*cos will be set to the cosine value."
2571summary: Approximate sine and cosine
2572description:
2573 Returns the approximate sine and cosine of a value.
2574
2575 See also @sincos().
2576# TODO Temporary
2577test: limited(0.0005)
2578end:
2579
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002580function: native_sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002581version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002582w: 1, 2, 3, 4
2583t: f16
2584ret: #2#1
2585arg: #2#1 v
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002586arg: #2#1* cos, range(-314,314)
2587# Absolute error of 2^-11, i.e. 0.00048828125
2588test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002589end:
2590
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002591function: native_sinh
2592version: 21
2593attrib: const
2594w: 1, 2, 3, 4
2595t: f32
2596ret: #2#1
2597arg: #2#1 v
2598summary: Approximate hyperbolic sine
2599description:
2600 Returns the approximate hyperbolic sine of a value specified in radians.
2601
2602 See also @sinh().
2603end:
2604
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002605function: native_sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002606version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002607attrib: const
2608w: 1, 2, 3, 4
2609t: f16
2610ret: #2#1
2611arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002612end:
2613
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002614function: native_sinpi
2615version: 21
2616attrib: const
2617w: 1, 2, 3, 4
2618t: f32
2619ret: #2#1
2620arg: #2#1 v
2621summary: Approximate sine of a number multiplied by pi
2622description:
2623 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2624
2625 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2626
2627 See also @sinpi().
2628end:
2629
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002630function: native_sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002631version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002632attrib: const
2633w: 1, 2, 3, 4
2634t: f16
2635ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002636arg: #2#1 v, range(-100,100)
2637# Absolute error of 2^-11, i.e. 0.00048828125
2638test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002639end:
2640
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002641function: native_sqrt
2642version: 21
2643attrib: const
2644w: 1, 2, 3, 4
2645t: f32
2646ret: #2#1
2647arg: #2#1 v
2648summary: Approximate square root
2649description:
2650 Returns the approximate sqrt(v).
2651
2652 See also @sqrt(), @half_sqrt().
2653end:
2654
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002655function: native_sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002656version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002657attrib: const
2658w: 1, 2, 3, 4
2659t: f16
2660ret: #2#1
2661arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002662end:
2663
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002664function: native_tan
2665version: 21
2666attrib: const
2667w: 1, 2, 3, 4
2668t: f32
2669ret: #2#1
2670arg: #2#1 v
2671summary: Approximate tangent
2672description:
2673 Returns the approximate tangent of an angle measured in radians.
2674end:
2675
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002676function: native_tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002677version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002678attrib: const
2679w: 1, 2, 3, 4
2680t: f16
2681ret: #2#1
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002682arg: #2#1 v, range(-314,314)
2683test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002684end:
2685
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002686function: native_tanh
2687version: 21
2688attrib: const
2689w: 1, 2, 3, 4
2690t: f32
2691ret: #2#1
2692arg: #2#1 v
2693summary: Approximate hyperbolic tangent
2694description:
2695 Returns the approximate hyperbolic tangent of a value.
2696
2697 See also @tanh().
2698end:
2699
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002700function: native_tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002701version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002702attrib: const
2703w: 1, 2, 3, 4
2704t: f16
2705ret: #2#1
2706arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002707end:
2708
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002709function: native_tanpi
2710version: 21
2711attrib: const
2712w: 1, 2, 3, 4
2713t: f32
2714ret: #2#1
2715arg: #2#1 v
2716summary: Approximate tangent of a number multiplied by pi
2717description:
2718 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2719
2720 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2721
2722 See also @tanpi().
2723end:
2724
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002725function: native_tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002726version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002727attrib: const
2728w: 1, 2, 3, 4
2729t: f16
2730ret: #2#1
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002731arg: #2#1 v, range(-100,100)
2732test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002733end:
2734
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002735function: nextafter
2736version: 9
2737attrib: const
2738w: 1, 2, 3, 4
2739t: f32
2740ret: #2#1
2741arg: #2#1 v
2742arg: #2#1 target
2743summary: Next floating point number
2744description:
2745 Returns the next representable floating point number from v towards target.
2746
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002747 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2748 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002749end:
2750
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002751function: nextafter
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002752version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002753attrib: const
2754w: 1, 2, 3, 4
2755t: f16
2756ret: #2#1
2757arg: #2#1 v
2758arg: #2#1 target
2759test: none
2760end:
2761
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002762function: pow
2763version: 9
2764attrib: const
2765w: 1, 2, 3, 4
2766t: f32
2767ret: #2#1
2768arg: #2#1 base
2769arg: #2#1 exponent
2770summary: Base raised to an exponent
2771description:
2772 Returns base raised to the power exponent, i.e. base ^ exponent.
2773
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002774 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2775 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002776end:
2777
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002778function: pow
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002779version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002780attrib: const
2781w: 1, 2, 3, 4
2782t: f16
2783ret: #2#1
2784arg: #2#1 base
2785arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002786end:
2787
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002788function: pown
2789version: 9
2790attrib: const
2791w: 1, 2, 3, 4
2792t: f32
2793ret: #2#1
2794arg: #2#1 base
2795arg: int#1 exponent
2796summary: Base raised to an integer exponent
2797description:
2798 Returns base raised to the power exponent, i.e. base ^ exponent.
2799
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002800 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2801 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002802end:
2803
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002804function: pown
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002805version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002806attrib: const
2807w: 1, 2, 3, 4
2808t: f16
2809ret: #2#1
2810arg: #2#1 base
2811arg: int#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002812end:
2813
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002814function: powr
2815version: 9
2816attrib: const
2817w: 1, 2, 3, 4
2818t: f32
2819ret: #2#1
2820arg: #2#1 base, range(0,3000)
2821arg: #2#1 exponent
2822summary: Positive base raised to an exponent
2823description:
2824 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2825
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002826 @pow() and @pown() are similar. They both make no assumptions about the base.
2827 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002828
2829 See also @native_powr().
2830end:
2831
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002832function: powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002833version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002834attrib: const
2835w: 1, 2, 3, 4
2836t: f16
2837ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -07002838arg: #2#1 base, range(0,300)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002839arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002840end:
2841
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002842function: radians
2843version: 9
2844attrib: const
2845w: 1, 2, 3, 4
2846t: f32
2847ret: #2#1
2848arg: #2#1 v
2849summary: Converts degrees into radians
2850description:
2851 Converts from degrees to radians.
2852end:
2853
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002854function: radians
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002855version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002856attrib: const
2857w: 1, 2, 3, 4
2858t: f16
2859ret: #2#1
2860arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002861end:
2862
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002863function: remainder
2864version: 9
2865attrib: const
2866w: 1, 2, 3, 4
2867t: f32
2868ret: #2#1
2869arg: #2#1 numerator
2870arg: #2#1 denominator
2871summary: Remainder of a division
2872description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002873 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2874 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002875
2876 The function @fmod() is similar but rounds toward the closest interger.
2877 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2878 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2879end:
2880
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002881function: remainder
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002882version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002883attrib: const
2884w: 1, 2, 3, 4
2885t: f16
2886ret: #2#1
2887arg: #2#1 numerator
2888arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002889end:
2890
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002891function: remquo
2892version: 9
2893w: 1, 2, 3, 4
2894t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002895ret: #2#1, "Remainder, precise only for the low three bits."
2896arg: #2#1 numerator, "Numerator."
2897arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002898arg: int#1* quotient, "*quotient will be set to the integer quotient."
2899summary: Remainder and quotient of a division
2900description:
2901 Returns the quotient and the remainder of (numerator / denominator).
2902
2903 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2904
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002905 This function is useful for implementing periodic functions. The low three bits of the
2906 quotient gives the quadrant and the remainder the distance within the quadrant.
2907 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2908 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002909
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002910 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2911 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002912test: custom
2913end:
2914
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002915function: remquo
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002916version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002917w: 1, 2, 3, 4
2918t: f16
2919ret: #2#1
2920arg: #2#1 numerator
2921arg: #2#1 denominator
2922arg: int#1* quotient
2923test: none
2924end:
2925
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002926function: rint
2927version: 9
2928attrib: const
2929w: 1, 2, 3, 4
2930t: f32
2931ret: #2#1
2932arg: #2#1 v
2933summary: Round to even
2934description:
2935 Rounds to the nearest integral value.
2936
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002937 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2938 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2939 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002940
2941 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2942end:
2943
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002944function: rint
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002945version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002946attrib: const
2947w: 1, 2, 3, 4
2948t: f16
2949ret: #2#1
2950arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002951end:
2952
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002953function: rootn
2954version: 9
2955attrib: const
2956w: 1, 2, 3, 4
2957t: f32
2958ret: #2#1
2959arg: #2#1 v
2960arg: int#1 n
2961summary: Nth root
2962description:
2963 Compute the Nth root of a value.
2964
2965 See also @native_rootn().
2966end:
2967
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002968function: rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002969version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002970attrib: const
2971w: 1, 2, 3, 4
2972t: f16
2973ret: #2#1
2974arg: #2#1 v
2975arg: int#1 n
2976test: none
2977end:
2978
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002979function: round
2980version: 9
2981attrib: const
2982w: 1, 2, 3, 4
2983t: f32
2984ret: #2#1
2985arg: #2#1 v
2986summary: Round away from zero
2987description:
2988 Round to the nearest integral value.
2989
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002990 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
2991 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
2992 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002993
2994 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
2995end:
2996
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002997function: round
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002998version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002999attrib: const
3000w: 1, 2, 3, 4
3001t: f16
3002ret: #2#1
3003arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003004end:
3005
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003006function: rsqrt
3007version: 9
3008attrib: const
3009w: 1, 2, 3, 4
3010t: f32
3011ret: #2#1
3012arg: #2#1 v
3013summary: Reciprocal of a square root
3014description:
3015 Returns (1 / sqrt(v)).
3016
3017 See also @half_rsqrt(), @native_rsqrt().
3018end:
3019
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003020function: rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003021version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003022attrib: const
3023w: 1, 2, 3, 4
3024t: f16
3025ret: #2#1
3026arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003027end:
3028
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003029function: sign
3030version: 9
3031attrib: const
3032w: 1, 2, 3, 4
3033t: f32
3034ret: #2#1
3035arg: #2#1 v
3036summary: Sign of a value
3037description:
3038 Returns the sign of a value.
3039
3040 if (v &lt; 0) return -1.f;
3041 else if (v &gt; 0) return 1.f;
3042 else return 0.f;
3043end:
3044
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003045function: sign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003046version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003047attrib: const
3048w: 1, 2, 3, 4
3049t: f16
3050ret: #2#1
3051arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003052end:
3053
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003054function: sin
3055version: 9
3056attrib: const
3057w: 1, 2, 3, 4
3058t: f32
3059ret: #2#1
3060arg: #2#1 v
3061summary: Sine
3062description:
3063 Returns the sine of an angle measured in radians.
3064
3065 See also @native_sin().
3066end:
3067
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003068function: sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003069version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003070attrib: const
3071w: 1, 2, 3, 4
3072t: f16
3073ret: #2#1
3074arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003075end:
3076
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003077function: sincos
3078version: 9
3079w: 1, 2, 3, 4
3080t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003081ret: #2#1, "Sine of v."
3082arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003083arg: #2#1* cos, "*cos will be set to the cosine value."
3084summary: Sine and cosine
3085description:
3086 Returns the sine and cosine of a value.
3087
3088 See also @native_sincos().
3089end:
3090
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003091function: sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003092version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003093w: 1, 2, 3, 4
3094t: f16
3095ret: #2#1
3096arg: #2#1 v
3097arg: #2#1* cos
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003098end:
3099
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003100function: sinh
3101version: 9
3102attrib: const
3103w: 1, 2, 3, 4
3104t: f32
3105ret: #2#1
3106arg: #2#1 v
3107summary: Hyperbolic sine
3108description:
3109 Returns the hyperbolic sine of v, where v is measured in radians.
3110
3111 See also @native_sinh().
3112end:
3113
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003114function: sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003115version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003116attrib: const
3117w: 1, 2, 3, 4
3118t: f16
3119ret: #2#1
3120arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003121end:
3122
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003123function: sinpi
3124version: 9
3125attrib: const
3126w: 1, 2, 3, 4
3127t: f32
3128ret: #2#1
3129arg: #2#1 v
3130summary: Sine of a number multiplied by pi
3131description:
3132 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3133
3134 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3135
3136 See also @native_sinpi().
3137end:
3138
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003139function: sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003140version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003141attrib: const
3142w: 1, 2, 3, 4
3143t: f16
3144ret: #2#1
3145arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003146end:
3147
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003148function: sqrt
3149version: 9
3150attrib: const
3151w: 1, 2, 3, 4
3152t: f32
3153ret: #2#1
3154arg: #2#1 v
3155summary: Square root
3156description:
3157 Returns the square root of a value.
3158
3159 See also @half_sqrt(), @native_sqrt().
3160end:
3161
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003162function: sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003163version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003164attrib: const
3165w: 1, 2, 3, 4
3166t: f16
3167ret: #2#1
3168arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003169end:
3170
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003171function: step
3172version: 9
3173attrib: const
3174w: 1, 2, 3, 4
3175t: f32
3176ret: #2#1
3177arg: #2#1 edge
3178arg: #2#1 v
3179summary: 0 if less than a value, 0 otherwise
3180description:
3181 Returns 0.f if v &lt; edge, 1.f otherwise.
3182
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003183 This can be useful to create conditional computations without using loops and branching
3184 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3185 for the corresponding elements of a vector, you could instead use <code>step(a, b) * @atan2(a, b)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003186end:
3187
3188function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003189version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003190attrib: const
3191w: 1, 2, 3, 4
3192t: f16
3193ret: #2#1
3194arg: #2#1 edge
3195arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003196end:
3197
3198function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003199version: 9
3200attrib: const
3201w: 2, 3, 4
3202t: f32
3203ret: #2#1
3204arg: #2#1 edge
3205arg: #2 v
3206end:
3207
3208function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003209version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003210attrib: const
3211w: 2, 3, 4
3212t: f16
3213ret: #2#1
3214arg: #2#1 edge
3215arg: #2 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003216end:
3217
3218function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003219version: 21
3220attrib: const
3221w: 2, 3, 4
3222t: f32
3223ret: #2#1
3224arg: #2 edge
3225arg: #2#1 v
3226end:
3227
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003228function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003229version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003230attrib: const
3231w: 2, 3, 4
3232t: f16
3233ret: #2#1
3234arg: #2 edge
3235arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003236end:
3237
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003238function: tan
3239version: 9
3240attrib: const
3241w: 1, 2, 3, 4
3242t: f32
3243ret: #2#1
3244arg: #2#1 v
3245summary: Tangent
3246description:
3247 Returns the tangent of an angle measured in radians.
3248
3249 See also @native_tan().
3250end:
3251
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003252function: tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003253version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003254attrib: const
3255w: 1, 2, 3, 4
3256t: f16
3257ret: #2#1
3258arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003259end:
3260
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003261function: tanh
3262version: 9
3263attrib: const
3264w: 1, 2, 3, 4
3265t: f32
3266ret: #2#1
3267arg: #2#1 v
3268summary: Hyperbolic tangent
3269description:
3270 Returns the hyperbolic tangent of a value.
3271
3272 See also @native_tanh().
3273end:
3274
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003275function: tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003276version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003277attrib: const
3278w: 1, 2, 3, 4
3279t: f16
3280ret: #2#1
3281arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003282end:
3283
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003284function: tanpi
3285version: 9
3286attrib: const
3287w: 1, 2, 3, 4
3288t: f32
3289ret: #2#1
3290arg: #2#1 v
3291summary: Tangent of a number multiplied by pi
3292description:
3293 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3294
3295 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3296
3297 See also @native_tanpi().
3298end:
3299
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003300function: tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003301version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003302attrib: const
3303w: 1, 2, 3, 4
3304t: f16
3305ret: #2#1
3306arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003307end:
3308
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003309function: tgamma
3310version: 9
3311attrib: const
3312w: 1, 2, 3, 4
3313t: f32
3314ret: #2#1
3315arg: #2#1 v
3316summary: Gamma function
3317description:
3318 Returns the gamma function of a value.
3319
3320 See also @lgamma().
3321end:
3322
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003323function: tgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003324version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003325attrib: const
3326w: 1, 2, 3, 4
3327t: f16
3328ret: #2#1
3329arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003330end:
3331
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003332function: trunc
3333version: 9
3334attrib: const
3335w: 1, 2, 3, 4
3336t: f32
3337ret: #2#1
3338arg: #2#1 v
3339summary: Truncates a floating point
3340description:
3341 Rounds to integral using truncation.
3342
3343 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3344
3345 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003346end:
3347
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003348function: trunc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003349version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003350attrib: const
3351w: 1, 2, 3, 4
3352t: f16
3353ret: #2#1
3354arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003355end:
3356
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003357function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003358attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003359t: i8, i16, i32, u8, u16, u32
3360ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003361arg: #1 amount, "Value to clamp."
3362arg: #1 low, "Lower bound."
3363arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003364deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003365summary: Restrain a value to a range
3366description:
3367 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003368test: none
3369end:
3370
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003371function: rsFrac
3372attrib: const
3373ret: float
3374arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003375deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003376summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003377description:
3378 Returns the fractional part of a float
3379test: none
3380end:
3381
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003382function: rsRand
3383ret: int
3384arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003385summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003386description:
3387 Return a random value between 0 (or min_value) and max_malue.
3388test: none
3389end:
3390
3391function: rsRand
3392ret: int
3393arg: int min_value
3394arg: int max_value
3395test: none
3396end:
3397
3398function: rsRand
3399ret: float
3400arg: float max_value
3401test: none
3402end:
3403
3404function: rsRand
3405ret: float
3406arg: float min_value
3407arg: float max_value
3408test: none
3409end: