blob: dda9867a5b32392ec58d338c235ebb407b634b40 [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)
541test: none
542end:
543
544function: clamp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800545version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800546attrib: const
547w: 2, 3, 4
548t: f16
549ret: #2#1
550arg: #2#1 value
551arg: #2 min_value
552arg: #2 max_value, above(min_value)
553test: none
554end:
555
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700556function: clz
557version: 9
558attrib: const
559w: 1, 2, 3, 4
560t: u8, u16, u32, i8, i16, i32
561ret: #2#1
562arg: #2#1 value
563summary: Number of leading 0 bits
564description:
565 Returns the number of leading 0-bits in a value.
566
567 For example, <code>clz((char)0x03)</code> returns 6.
568end:
569
570function: copysign
571version: 9
572attrib: const
573w: 1, 2, 3, 4
574t: f32
575ret: #2#1
576arg: #2#1 magnitude_value
577arg: #2#1 sign_value
578summary: Copies the sign of a number to another
579description:
580 Copies the sign from sign_value to magnitude_value.
581
582 The value returned is either magnitude_value or -magnitude_value.
583
584 For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
585end:
586
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800587function: copysign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800588version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800589attrib: const
590w: 1, 2, 3, 4
591t: f16
592ret: #2#1
593arg: #2#1 magnitude_value
594arg: #2#1 sign_value
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800595end:
596
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700597function: cos
598version: 9
599attrib: const
600w: 1, 2, 3, 4
601t: f32
602ret: #2#1
603arg: #2#1 v
604summary: Cosine
605description:
606 Returns the cosine of an angle measured in radians.
607
608 See also @native_cos().
609end:
610
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800611function: cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800612version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800613attrib: const
614w: 1, 2, 3, 4
615t: f16
616ret: #2#1
617arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800618end:
619
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700620function: cosh
621version: 9
622attrib: const
623w: 1, 2, 3, 4
624t: f32
625ret: #2#1
626arg: #2#1 v
627summary: Hypebolic cosine
628description:
629 Returns the hypebolic cosine of v, where v is measured in radians.
630
631 See also @native_cosh().
632end:
633
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800634function: cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800635version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800636attrib: const
637w: 1, 2, 3, 4
638t: f16
639ret: #2#1
640arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800641end:
642
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700643function: cospi
644version: 9
645attrib: const
646w: 1, 2, 3, 4
647t: f32
648ret: #2#1
649arg: #2#1 v
650summary: Cosine of a number multiplied by pi
651description:
652 Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
653
654 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
655
656 See also @native_cospi().
657end:
658
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800659function: cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800660version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800661attrib: const
662w: 1, 2, 3, 4
663t: f16
664ret: #2#1
665arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800666end:
667
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700668function: degrees
669version: 9
670attrib: const
671w: 1, 2, 3, 4
672t: f32
673ret: #2#1
674arg: #2#1 v
675summary: Converts radians into degrees
676description:
677 Converts from radians to degrees.
678end:
679
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800680function: degrees
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800681version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800682attrib: const
683w: 1, 2, 3, 4
684t: f16
685ret: #2#1
686arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800687end:
688
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700689function: erf
690version: 9
691attrib: const
692w: 1, 2, 3, 4
693t: f32
694ret: #2#1
695arg: #2#1 v
696summary: Mathematical error function
697description:
698 Returns the error function.
699end:
700
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800701function: erf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800702version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800703attrib: const
704w: 1, 2, 3, 4
705t: f16
706ret: #2#1
707arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800708end:
709
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700710function: erfc
711version: 9
712attrib: const
713w: 1, 2, 3, 4
714t: f32
715ret: #2#1
716arg: #2#1 v
717summary: Mathematical complementary error function
718description:
719 Returns the complementary error function.
720end:
721
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800722function: erfc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800723version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800724attrib: const
725w: 1, 2, 3, 4
726t: f16
727ret: #2#1
728arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800729end:
730
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700731function: exp
732version: 9
733attrib: const
734w: 1, 2, 3, 4
735t: f32
736ret: #2#1
737arg: #2#1 v
738summary: e raised to a number
739description:
740 Returns e raised to v, i.e. e ^ v.
741
742 See also @native_exp().
743end:
744
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800745function: exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800746version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800747attrib: const
748w: 1, 2, 3, 4
749t: f16
750ret: #2#1
751arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800752end:
753
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700754function: exp10
755version: 9
756attrib: const
757w: 1, 2, 3, 4
758t: f32
759ret: #2#1
760arg: #2#1 v
761summary: 10 raised to a number
762description:
763 Returns 10 raised to v, i.e. 10.f ^ v.
764
765 See also @native_exp10().
766end:
767
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800768function: exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800769version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800770attrib: const
771w: 1, 2, 3, 4
772t: f16
773ret: #2#1
774arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800775end:
776
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700777function: exp2
778version: 9
779attrib: const
780w: 1, 2, 3, 4
781t: f32
782ret: #2#1
783arg: #2#1 v
784summary: 2 raised to a number
785description:
786 Returns 2 raised to v, i.e. 2.f ^ v.
787
788 See also @native_exp2().
789end:
790
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800791function: exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800792version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800793attrib: const
794w: 1, 2, 3, 4
795t: f16
796ret: #2#1
797arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800798end:
799
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700800function: expm1
801version: 9
802attrib: const
803w: 1, 2, 3, 4
804t: f32
805ret: #2#1
806arg: #2#1 v
807summary: e raised to a number minus one
808description:
809 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
810
811 See also @native_expm1().
812end:
813
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800814function: expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800815version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800816attrib: const
817w: 1, 2, 3, 4
818t: f16
819ret: #2#1
820arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800821end:
822
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700823function: fabs
824version: 9
825attrib: const
826w: 1, 2, 3, 4
827t: f32
828ret: #2#1
829arg: #2#1 v
830summary: Absolute value of a float
831description:
832 Returns the absolute value of the float v.
833
834 For integers, use @abs().
835end:
836
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800837function: fabs
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800838version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800839attrib: const
840w: 1, 2, 3, 4
841t: f16
842ret: #2#1
843arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800844end:
845
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700846function: fdim
847version: 9
848attrib: const
849w: 1, 2, 3, 4
850t: f32
851ret: #2#1
852arg: #2#1 a
853arg: #2#1 b
854summary: Positive difference between two values
855description:
856 Returns the positive difference between two values.
857
858 If a &gt; b, returns (a - b) otherwise returns 0f.
859end:
860
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800861function: fdim
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800862version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800863attrib: const
864w: 1, 2, 3, 4
865t: f16
866ret: #2#1
867arg: #2#1 a
868arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800869end:
870
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700871function: floor
872version: 9
873attrib: const
874w: 1, 2, 3, 4
875t: f32
876ret: #2#1
877arg: #2#1 v
878summary: Smallest integer not greater than a value
879description:
880 Returns the smallest integer not greater than a value.
881
882 For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
883
884 See also @ceil().
885end:
886
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800887function: floor
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800888version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800889attrib: const
890w: 1, 2, 3, 4
891t: f16
892ret: #2#1
893arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800894end:
895
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700896function: fma
897version: 9
898attrib: const
899w: 1, 2, 3, 4
900t: f32
901ret: #2#1
902arg: #2#1 multiplicand1
903arg: #2#1 multiplicand2
904arg: #2#1 offset
905summary: Multiply and add
906description:
907 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
908
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700909 This function is similar to @mad(). fma() retains full precision of the multiplied result
910 and rounds only after the addition. @mad() rounds after the multiplication and the addition.
911 This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700912end:
913
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800914function: fma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800915version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800916attrib: const
917w: 1, 2, 3, 4
918t: f16
919ret: #2#1
920arg: #2#1 multiplicand1
921arg: #2#1 multiplicand2
922arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800923end:
924
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700925function: fmax
926version: 9
927attrib: const
928w: 1, 2, 3, 4
929t: f32
930ret: #2#1
931arg: #2#1 a
932arg: #2#1 b
933summary: Maximum of two floats
934description:
935 Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
936
937 The @max() function returns identical results but can be applied to more data types.
938end:
939
940function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800941version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800942attrib: const
943w: 1, 2, 3, 4
944t: f16
945ret: #2#1
946arg: #2#1 a
947arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800948end:
949
950function: fmax
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700951version: 9
952attrib: const
953w: 2, 3, 4
954t: f32
955ret: #2#1
956arg: #2#1 a
957arg: #2 b
958end:
959
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800960function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800961version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800962attrib: const
963w: 2, 3, 4
964t: f16
965ret: #2#1
966arg: #2#1 a
967arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800968end:
969
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700970function: fmin
971version: 9
972attrib: const
973w: 1, 2, 3, 4
974t: f32
975ret: #2#1
976arg: #2#1 a
977arg: #2#1 b
978summary: Minimum of two floats
979description:
980 Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
981
982 The @min() function returns identical results but can be applied to more data types.
983end:
984
985function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800986version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800987attrib: const
988w: 1, 2, 3, 4
989t: f16
990ret: #2#1
991arg: #2#1 a
992arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800993end:
994
995function: fmin
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700996version: 9
997attrib: const
998w: 2, 3, 4
999t: f32
1000ret: #2#1
1001arg: #2#1 a
1002arg: #2 b
1003end:
1004
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001005function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001006version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001007attrib: const
1008w: 2, 3, 4
1009t: f16
1010ret: #2#1
1011arg: #2#1 a
1012arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001013end:
1014
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001015function: fmod
1016version: 9
1017attrib: const
1018w: 1, 2, 3, 4
1019t: f32
1020ret: #2#1
1021arg: #2#1 numerator
1022arg: #2#1 denominator
1023summary: Modulo
1024description:
1025 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1026
1027 The function @remainder() is similar but rounds toward the closest interger.
1028 For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
1029 while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
1030end:
1031
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001032function: fmod
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001033version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001034attrib: const
1035w: 1, 2, 3, 4
1036t: f16
1037ret: #2#1
1038arg: #2#1 numerator
1039arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001040end:
1041
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001042function: fract
1043version: 9
1044w: 1, 2, 3, 4
1045t: f32
1046ret: #2#1
1047arg: #2#1 v, "Input value."
1048arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
1049summary: Positive fractional part
1050description:
1051 Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
1052
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001053 For example, <code>fract(1.3f, &amp;val)</code> returns 0.3f and sets val to 1.f.
1054 <code>fract(-1.3f, &amp;val)</code> returns 0.7f and sets val to -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001055end:
1056
1057function: fract
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001058version: 9 23
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001059attrib: const
1060w: 1, 2, 3, 4
1061t: f32
1062ret: #2#1
1063arg: #2#1 v
1064inline:
1065 #2#1 unused;
1066 return fract(v, &unused);
1067end:
1068
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001069function: fract
1070version: 24
1071w: 1, 2, 3, 4
1072t: f32
1073ret: #2#1
1074arg: #2#1 v
1075end:
1076
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001077function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001078version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001079w: 1, 2, 3, 4
1080t: f16
1081ret: #2#1
1082arg: #2#1 v
1083arg: #2#1* floor
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001084end:
1085
1086function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001087version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001088w: 1, 2, 3, 4
1089t: f16
1090ret: #2#1
1091arg: #2#1 v
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001092end:
1093
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001094function: frexp
1095version: 9
1096w: 1, 2, 3, 4
1097t: f32
1098ret: #2#1
1099arg: #2#1 v, "Input value."
1100arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1101summary: Binary mantissa and exponent
1102description:
1103 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1104
1105 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1106
1107 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1108end:
1109
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001110function: frexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001111version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001112w: 1, 2, 3, 4
1113t: f16
1114ret: #2#1
1115arg: #2#1 v
1116arg: int#1* exponent
1117test: none
1118end:
1119
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001120function: half_recip
1121version: 17
1122attrib: const
1123w: 1, 2, 3, 4
1124t: f32
1125ret: #2#1
1126arg: #2#1 v
1127summary: Reciprocal computed to 16 bit precision
1128description:
1129 Returns the approximate reciprocal of a value.
1130
1131 The precision is that of a 16 bit floating point value.
1132
1133 See also @native_recip().
1134end:
1135
1136function: half_rsqrt
1137version: 17
1138attrib: const
1139w: 1, 2, 3, 4
1140t: f32
1141ret: #2#1
1142arg: #2#1 v
1143summary: Reciprocal of a square root computed to 16 bit precision
1144description:
1145 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1146
1147 The precision is that of a 16 bit floating point value.
1148
1149 See also @rsqrt(), @native_rsqrt().
1150end:
1151
1152function: half_sqrt
1153version: 17
1154attrib: const
1155w: 1, 2, 3, 4
1156t: f32
1157ret: #2#1
1158arg: #2#1 v
1159summary: Square root computed to 16 bit precision
1160description:
1161 Returns the approximate square root of a value.
1162
1163 The precision is that of a 16 bit floating point value.
1164
1165 See also @sqrt(), @native_sqrt().
1166end:
1167
1168function: hypot
1169version: 9
1170attrib: const
1171w: 1, 2, 3, 4
1172t: f32
1173ret: #2#1
1174arg: #2#1 a
1175arg: #2#1 b
1176summary: Hypotenuse
1177description:
1178 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1179
1180 See also @native_hypot().
1181end:
1182
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001183function: hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001184version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001185attrib: const
1186w: 1, 2, 3, 4
1187t: f16
1188ret: #2#1
1189arg: #2#1 a
1190arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001191end:
1192
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001193function: ilogb
1194version: 9
1195attrib: const
1196w: 1, 2, 3, 4
1197t: f32
1198ret: int#1
1199arg: float#1 v
1200summary: Base two exponent
1201description:
1202 Returns the base two exponent of a value, where the mantissa is between
1203 1.f (inclusive) and 2.f (exclusive).
1204
1205 For example, <code>ilogb(8.5f)</code> returns 3.
1206
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001207 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001208
1209 @logb() is similar but returns a float.
1210test: custom
1211end:
1212
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001213function: ilogb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001214version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001215attrib: const
1216w: 1, 2, 3, 4
1217t: f16
1218ret: int#1
1219arg: half#1 v
1220test: none
1221end:
1222
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001223function: ldexp
1224version: 9
1225attrib: const
1226w: 1, 2, 3, 4
1227ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001228arg: float#1 mantissa, "Mantissa."
1229arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001230summary: Creates a floating point from mantissa and exponent
1231description:
1232 Returns the floating point created from the mantissa and exponent,
1233 i.e. (mantissa * 2 ^ exponent).
1234
1235 See @frexp() for the reverse operation.
1236end:
1237
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001238function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001239version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001240attrib: const
1241w: 1, 2, 3, 4
1242ret: half#1
1243arg: half#1 mantissa
1244arg: int#1 exponent
1245test: none
1246end:
1247
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001248function: ldexp
1249version: 9
1250attrib: const
1251w: 2, 3, 4
1252ret: float#1
1253arg: float#1 mantissa
1254arg: int exponent
1255end:
1256
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001257function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001258version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001259attrib: const
1260w: 2, 3, 4
1261ret: half#1
1262arg: half#1 mantissa
1263arg: int exponent
1264test: none
1265end:
1266
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001267function: lgamma
1268version: 9
1269attrib: const
1270w: 1, 2, 3, 4
1271t: f32
1272ret: #2#1
1273arg: #2#1 v
1274summary: Natural logarithm of the gamma function
1275description:
1276 Returns the natural logarithm of the absolute value of the gamma function,
1277 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1278
1279 See also @tgamma().
1280end:
1281
1282function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001283version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001284attrib: const
1285w: 1, 2, 3, 4
1286t: f16
1287ret: #2#1
1288arg: #2#1 v
1289test: none
1290end:
1291
1292function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001293version: 9
1294w: 1, 2, 3, 4
1295t: f32
1296ret: #2#1
1297arg: #2#1 v
1298arg: 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."
1299test: custom
1300#TODO Temporary until bionic & associated drivers are fixed
1301end:
1302
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001303function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001304version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001305w: 1, 2, 3, 4
1306t: f16
1307ret: #2#1
1308arg: #2#1 v
1309arg: int#1* sign_of_gamma
1310test: none
1311end:
1312
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001313function: log
1314version: 9
1315attrib: const
1316w: 1, 2, 3, 4
1317t: f32
1318ret: #2#1
1319arg: #2#1 v
1320summary: Natural logarithm
1321description:
1322 Returns the natural logarithm.
1323
1324 See also @native_log().
1325end:
1326
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001327function: log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001328version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001329attrib: const
1330w: 1, 2, 3, 4
1331t: f16
1332ret: #2#1
1333arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001334end:
1335
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001336function: log10
1337version: 9
1338attrib: const
1339w: 1, 2, 3, 4
1340t: f32
1341ret: #2#1
1342arg: #2#1 v
1343summary: Base 10 logarithm
1344description:
1345 Returns the base 10 logarithm.
1346
1347 See also @native_log10().
1348end:
1349
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001350function: log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001351version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001352attrib: const
1353w: 1, 2, 3, 4
1354t: f16
1355ret: #2#1
1356arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001357end:
1358
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001359function: log1p
1360version: 9
1361attrib: const
1362w: 1, 2, 3, 4
1363t: f32
1364ret: #2#1
1365arg: #2#1 v
1366summary: Natural logarithm of a value plus 1
1367description:
1368 Returns the natural logarithm of <code>(v + 1.f)</code>.
1369
1370 See also @native_log1p().
1371end:
1372
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001373function: log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001374version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001375attrib: const
1376w: 1, 2, 3, 4
1377t: f16
1378ret: #2#1
1379arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001380end:
1381
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001382function: log2
1383version: 9
1384attrib: const
1385w: 1, 2, 3, 4
1386t: f32
1387ret: #2#1
1388arg: #2#1 v
1389summary: Base 2 logarithm
1390description:
1391 Returns the base 2 logarithm.
1392
1393 See also @native_log2().
1394end:
1395
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001396function: log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001397version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001398attrib: const
1399w: 1, 2, 3, 4
1400t: f16
1401ret: #2#1
1402arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001403end:
1404
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001405function: logb
1406version: 9
1407attrib: const
1408w: 1, 2, 3, 4
1409t: f32
1410ret: #2#1
1411arg: #2#1 v
1412summary: Base two exponent
1413description:
1414 Returns the base two exponent of a value, where the mantissa is between
1415 1.f (inclusive) and 2.f (exclusive).
1416
1417 For example, <code>logb(8.5f)</code> returns 3.f.
1418
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001419 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001420
1421 @ilogb() is similar but returns an integer.
1422end:
1423
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001424function: logb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001425version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001426attrib: const
1427w: 1, 2, 3, 4
1428t: f16
1429ret: #2#1
1430arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001431end:
1432
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001433function: mad
1434version: 9
1435attrib: const
1436w: 1, 2, 3, 4
1437t: f32
1438ret: #2#1
1439arg: #2#1 multiplicand1
1440arg: #2#1 multiplicand2
1441arg: #2#1 offset
1442summary: Multiply and add
1443description:
1444 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1445
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001446 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1447 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1448 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001449end:
1450
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001451function: mad
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001452version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001453attrib: const
1454w: 1, 2, 3, 4
1455t: f16
1456ret: #2#1
1457arg: #2#1 multiplicand1
1458arg: #2#1 multiplicand2
1459arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001460end:
1461
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001462function: max
1463version: 9
1464attrib: const
1465w: 1, 2, 3, 4
1466t: f32
1467ret: #2#1
1468arg: #2#1 a
1469arg: #2#1 b
1470summary: Maximum
1471description:
1472 Returns the maximum value of two arguments.
1473end:
1474
1475function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001476version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001477attrib: const
1478w: 1, 2, 3, 4
1479t: f16
1480ret: #2#1
1481arg: #2#1 a
1482arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001483end:
1484
1485function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001486version: 9
1487attrib: const
1488w: 2, 3, 4
1489t: f32
1490ret: #2#1
1491arg: #2#1 a
1492arg: #2 b
1493end:
1494
1495function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001496version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001497attrib: const
1498w: 2, 3, 4
1499t: f16
1500ret: #2#1
1501arg: #2#1 a
1502arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001503end:
1504
1505function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001506version: 9 20
1507attrib: const
1508w: 1
1509t: i8, i16, i32, u8, u16, u32
1510ret: #2#1
1511arg: #2#1 a
1512arg: #2#1 b
1513inline:
1514 return (a > b ? a : b);
1515end:
1516
1517function: max
1518version: 9 20
1519attrib: const
1520w: 2
1521t: i8, i16, i32, u8, u16, u32
1522ret: #2#1
1523arg: #2#1 a
1524arg: #2#1 b
1525inline:
1526 #2#1 tmp;
1527 tmp.x = (a.x > b.x ? a.x : b.x);
1528 tmp.y = (a.y > b.y ? a.y : b.y);
1529 return tmp;
1530end:
1531
1532function: max
1533version: 9 20
1534attrib: const
1535w: 3
1536t: i8, i16, i32, u8, u16, u32
1537ret: #2#1
1538arg: #2#1 a
1539arg: #2#1 b
1540inline:
1541 #2#1 tmp;
1542 tmp.x = (a.x > b.x ? a.x : b.x);
1543 tmp.y = (a.y > b.y ? a.y : b.y);
1544 tmp.z = (a.z > b.z ? a.z : b.z);
1545 return tmp;
1546end:
1547
1548function: max
1549version: 9 20
1550attrib: const
1551w: 4
1552t: i8, i16, i32, u8, u16, u32
1553ret: #2#1
1554arg: #2#1 a
1555arg: #2#1 b
1556inline:
1557 #2#1 tmp;
1558 tmp.x = (a.x > b.x ? a.x : b.x);
1559 tmp.y = (a.y > b.y ? a.y : b.y);
1560 tmp.z = (a.z > b.z ? a.z : b.z);
1561 tmp.w = (a.w > b.w ? a.w : b.w);
1562 return tmp;
1563end:
1564
1565function: max
1566version: 21
1567attrib: const
1568w: 1, 2, 3, 4
1569t: i8, i16, i32, i64, u8, u16, u32, u64
1570ret: #2#1
1571arg: #2#1 a
1572arg: #2#1 b
1573end:
1574
1575function: min
1576version: 9
1577attrib: const
1578w: 1, 2, 3, 4
1579t: f32
1580ret: #2#1
1581arg: #2#1 a
1582arg: #2#1 b
1583summary: Minimum
1584description:
1585 Returns the minimum value of two arguments.
1586end:
1587
1588function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001589version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001590attrib: const
1591w: 1, 2, 3, 4
1592t: f16
1593ret: #2#1
1594arg: #2#1 a
1595arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001596end:
1597
1598function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001599version: 9
1600attrib: const
1601w: 2, 3, 4
1602t: f32
1603ret: #2#1
1604arg: #2#1 a
1605arg: #2 b
1606end:
1607
1608function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001609version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001610attrib: const
1611w: 2, 3, 4
1612t: f16
1613ret: #2#1
1614arg: #2#1 a
1615arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001616end:
1617
1618function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001619version: 9 20
1620attrib: const
1621w: 1
1622t: i8, i16, i32, u8, u16, u32
1623ret: #2#1
1624arg: #2#1 a
1625arg: #2#1 b
1626inline:
1627 return (a < b ? a : b);
1628end:
1629
1630function: min
1631version: 9 20
1632attrib: const
1633w: 2
1634t: i8, i16, i32, u8, u16, u32
1635ret: #2#1
1636arg: #2#1 a
1637arg: #2#1 b
1638inline:
1639 #2#1 tmp;
1640 tmp.x = (a.x < b.x ? a.x : b.x);
1641 tmp.y = (a.y < b.y ? a.y : b.y);
1642 return tmp;
1643end:
1644
1645function: min
1646version: 9 20
1647attrib: const
1648w: 3
1649t: i8, i16, i32, u8, u16, u32
1650ret: #2#1
1651arg: #2#1 a
1652arg: #2#1 b
1653inline:
1654 #2#1 tmp;
1655 tmp.x = (a.x < b.x ? a.x : b.x);
1656 tmp.y = (a.y < b.y ? a.y : b.y);
1657 tmp.z = (a.z < b.z ? a.z : b.z);
1658 return tmp;
1659end:
1660
1661function: min
1662version: 9 20
1663attrib: const
1664w: 4
1665t: i8, i16, i32, u8, u16, u32
1666ret: #2#1
1667arg: #2#1 a
1668arg: #2#1 b
1669inline:
1670 #2#1 tmp;
1671 tmp.x = (a.x < b.x ? a.x : b.x);
1672 tmp.y = (a.y < b.y ? a.y : b.y);
1673 tmp.z = (a.z < b.z ? a.z : b.z);
1674 tmp.w = (a.w < b.w ? a.w : b.w);
1675 return tmp;
1676end:
1677
1678function: min
1679version: 21
1680attrib: const
1681w: 1, 2, 3, 4
1682t: i8, i16, i32, i64, u8, u16, u32, u64
1683ret: #2#1
1684arg: #2#1 a
1685arg: #2#1 b
1686end:
1687
1688function: mix
1689version: 9
1690attrib: const
1691w: 1, 2, 3, 4
1692t: f32
1693ret: #2#1
1694arg: #2#1 start
1695arg: #2#1 stop
1696arg: #2#1 fraction
1697summary: Mixes two values
1698description:
1699 Returns start + ((stop - start) * fraction).
1700
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001701 This can be useful for mixing two values. For example, to create a new color that is
1702 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001703end:
1704
1705function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001706version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001707attrib: const
1708w: 1, 2, 3, 4
1709t: f16
1710ret: #2#1
1711arg: #2#1 start
1712arg: #2#1 stop
1713arg: #2#1 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001714end:
1715
1716function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001717version: 9
1718attrib: const
1719w: 2, 3, 4
1720t: f32
1721ret: #2#1
1722arg: #2#1 start
1723arg: #2#1 stop
1724arg: #2 fraction
1725end:
1726
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001727function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001728version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001729attrib: const
1730w: 2, 3, 4
1731t: f16
1732ret: #2#1
1733arg: #2#1 start
1734arg: #2#1 stop
1735arg: #2 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001736end:
1737
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001738function: modf
1739version: 9
1740w: 1, 2, 3, 4
1741t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001742ret: #2#1, "Floating point portion of the value."
1743arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001744arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1745summary: Integral and fractional components
1746description:
1747 Returns the integral and fractional components of a number.
1748
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001749 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 -08001750 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001751end:
1752
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001753function: modf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001754version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001755w: 1, 2, 3, 4
1756t: f16
1757ret: #2#1
1758arg: #2#1 v
1759arg: #2#1* integral_part
1760test: none
1761end:
1762
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001763function: nan
1764version: 9
1765attrib: const
1766w: 1
1767t: f32
1768ret: #2#1
1769arg: uint#1 v, "Not used."
1770#TODO We're not using the argument. Once we do, add this documentation line:
1771# The argument is embedded into the return value and can be used to distinguish various NaNs.
1772summary: Not a Number
1773description:
1774 Returns a NaN value (Not a Number).
1775end:
1776
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001777function: nan_half
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001778version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001779attrib: const
1780t: f16
1781ret: #1
1782summary: Not a Number
1783description:
1784 Returns a half-precision floating point NaN value (Not a Number).
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001785end:
1786
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001787function: native_acos
1788version: 21
1789attrib: const
1790w: 1, 2, 3, 4
1791t: f32
1792ret: #2#1
1793arg: #2#1 v, range(-1,1)
1794summary: Approximate inverse cosine
1795description:
1796 Returns the approximate inverse cosine, in radians.
1797
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001798 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001799
1800 See also @acos().
1801# TODO Temporary
1802test: limited(0.0005)
1803end:
1804
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001805function: native_acos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001806version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001807attrib: const
1808w: 1, 2, 3, 4
1809t: f16
1810ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001811arg: #2#1 v, range(-1,1)
1812# Absolute error of 2^-11, i.e. 0.00048828125
1813test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001814end:
1815
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001816function: native_acosh
1817version: 21
1818attrib: const
1819w: 1, 2, 3, 4
1820t: f32
1821ret: #2#1
1822arg: #2#1 v
1823summary: Approximate inverse hyperbolic cosine
1824description:
1825 Returns the approximate inverse hyperbolic cosine, in radians.
1826
1827 See also @acosh().
1828# TODO Temporary
1829test: limited(0.0005)
1830end:
1831
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001832function: native_acosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001833version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001834attrib: const
1835w: 1, 2, 3, 4
1836t: f16
1837ret: #2#1
1838arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001839end:
1840
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001841function: native_acospi
1842version: 21
1843attrib: const
1844w: 1, 2, 3, 4
1845t: f32
1846ret: #2#1
1847arg: #2#1 v, range(-1,1)
1848summary: Approximate inverse cosine divided by pi
1849description:
1850 Returns the approximate inverse cosine in radians, divided by pi.
1851
1852 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1853
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001854 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001855
1856 See also @acospi().
1857# TODO Temporary
1858test: limited(0.0005)
1859end:
1860
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001861function: native_acospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001862version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001863attrib: const
1864w: 1, 2, 3, 4
1865t: f16
1866ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001867arg: #2#1 v, range(-1,1)
1868# Absolute error of 2^-11, i.e. 0.00048828125
1869test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001870end:
1871
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001872function: native_asin
1873version: 21
1874attrib: const
1875w: 1, 2, 3, 4
1876t: f32
1877ret: #2#1
1878arg: #2#1 v, range(-1,1)
1879summary: Approximate inverse sine
1880description:
1881 Returns the approximate inverse sine, in radians.
1882
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001883 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001884
1885 See also @asin().
1886# TODO Temporary
1887test: limited(0.0005)
1888end:
1889
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001890function: native_asin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001891version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001892attrib: const
1893w: 1, 2, 3, 4
1894t: f16
1895ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001896arg: #2#1 v, range(-1,1)
1897# Absolute error of 2^-11, i.e. 0.00048828125
1898test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001899end:
1900
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001901function: native_asinh
1902version: 21
1903attrib: const
1904w: 1, 2, 3, 4
1905t: f32
1906ret: #2#1
1907arg: #2#1 v
1908summary: Approximate inverse hyperbolic sine
1909description:
1910 Returns the approximate inverse hyperbolic sine, in radians.
1911
1912 See also @asinh().
1913# TODO Temporary
1914test: limited(0.0005)
1915end:
1916
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001917function: native_asinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001918version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001919attrib: const
1920w: 1, 2, 3, 4
1921t: f16
1922ret: #2#1
1923arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001924end:
1925
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001926function: native_asinpi
1927version: 21
1928attrib: const
1929w: 1, 2, 3, 4
1930t: f32
1931ret: #2#1
1932arg: #2#1 v, range(-1,1)
1933summary: Approximate inverse sine divided by pi
1934description:
1935 Returns the approximate inverse sine in radians, divided by pi.
1936
1937 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1938
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001939 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001940
1941 See also @asinpi().
1942# TODO Temporary
1943test: limited(0.0005)
1944end:
1945
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001946function: native_asinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001947version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001948attrib: const
1949w: 1, 2, 3, 4
1950t: f16
1951ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001952arg: #2#1 v, range(-1,1)
1953# Absolute error of 2^-11, i.e. 0.00048828125
1954test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001955end:
1956
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001957function: native_atan
1958version: 21
1959attrib: const
1960w: 1, 2, 3, 4
1961t: f32
1962ret: #2#1
1963arg: #2#1 v, range(-1,1)
1964summary: Approximate inverse tangent
1965description:
1966 Returns the approximate inverse tangent, in radians.
1967
1968 See also @atan().
1969# TODO Temporary
1970test: limited(0.0005)
1971end:
1972
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001973function: native_atan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001974version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001975attrib: const
1976w: 1, 2, 3, 4
1977t: f16
1978ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07001979arg: #2#1 v, range(-1, 1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001980end:
1981
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001982function: native_atan2
1983version: 21
1984attrib: const
1985w: 1, 2, 3, 4
1986t: f32
1987ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001988arg: #2#1 numerator, "Numerator."
1989arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001990summary: Approximate inverse tangent of a ratio
1991description:
1992 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
1993
1994 See also @atan2().
1995# TODO Temporary
1996test: limited(0.0005)
1997end:
1998
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001999function: native_atan2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002000version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002001attrib: const
2002w: 1, 2, 3, 4
2003t: f16
2004ret: #2#1
2005arg: #2#1 numerator
2006arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002007end:
2008
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002009function: native_atan2pi
2010version: 21
2011attrib: const
2012w: 1, 2, 3, 4
2013t: f32
2014ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002015arg: #2#1 numerator, "Numerator."
2016arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002017summary: Approximate inverse tangent of a ratio, divided by pi
2018description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002019 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2020 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002021
2022 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2023
2024 See also @atan2pi().
2025# TODO Temporary
2026test: limited(0.0005)
2027end:
2028
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002029function: native_atan2pi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002030version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002031attrib: const
2032w: 1, 2, 3, 4
2033t: f16
2034ret: #2#1
2035arg: #2#1 numerator
2036arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002037end:
2038
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002039function: native_atanh
2040version: 21
2041attrib: const
2042w: 1, 2, 3, 4
2043t: f32
2044ret: #2#1
2045arg: #2#1 v, range(-1,1)
2046summary: Approximate inverse hyperbolic tangent
2047description:
2048 Returns the approximate inverse hyperbolic tangent, in radians.
2049
2050 See also @atanh().
2051# TODO Temporary
2052test: limited(0.0005)
2053end:
2054
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002055function: native_atanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002056version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002057attrib: const
2058w: 1, 2, 3, 4
2059t: f16
2060ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002061arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002062end:
2063
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002064function: native_atanpi
2065version: 21
2066attrib: const
2067w: 1, 2, 3, 4
2068t: f32
2069ret: #2#1
2070arg: #2#1 v, range(-1,1)
2071summary: Approximate inverse tangent divided by pi
2072description:
2073 Returns the approximate inverse tangent in radians, divided by pi.
2074
2075 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2076
2077 See also @atanpi().
2078# TODO Temporary
2079test: limited(0.0005)
2080end:
2081
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002082function: native_atanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002083version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002084attrib: const
2085w: 1, 2, 3, 4
2086t: f16
2087ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002088arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002089end:
2090
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002091function: native_cbrt
2092version: 21
2093attrib: const
2094w: 1, 2, 3, 4
2095t: f32
2096ret: #2#1
2097arg: #2#1 v
2098summary: Approximate cube root
2099description:
2100 Returns the approximate cubic root.
2101
2102 See also @cbrt().
2103end:
2104
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002105function: native_cbrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002106version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002107attrib: const
2108w: 1, 2, 3, 4
2109t: f16
2110ret: #2#1
2111arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002112end:
2113
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002114function: native_cos
2115version: 21
2116attrib: const
2117w: 1, 2, 3, 4
2118t: f32
2119ret: #2#1
2120arg: #2#1 v
2121summary: Approximate cosine
2122description:
2123 Returns the approximate cosine of an angle measured in radians.
2124
2125 See also @cos().
2126end:
2127
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002128function: native_cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002129version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002130attrib: const
2131w: 1, 2, 3, 4
2132t: f16
2133ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002134arg: #2#1 v, range(-314,314)
2135# Absolute error of 2^-11, i.e. 0.00048828125
2136test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002137end:
2138
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002139function: native_cosh
2140version: 21
2141attrib: const
2142w: 1, 2, 3, 4
2143t: f32
2144ret: #2#1
2145arg: #2#1 v
2146summary: Approximate hypebolic cosine
2147description:
2148 Returns the approximate hypebolic cosine.
2149
2150 See also @cosh().
2151end:
2152
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002153function: native_cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002154version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002155attrib: const
2156w: 1, 2, 3, 4
2157t: f16
2158ret: #2#1
2159arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002160end:
2161
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002162function: native_cospi
2163version: 21
2164attrib: const
2165w: 1, 2, 3, 4
2166t: f32
2167ret: #2#1
2168arg: #2#1 v
2169summary: Approximate cosine of a number multiplied by pi
2170description:
2171 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2172
2173 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2174
2175 See also @cospi().
2176end:
2177
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002178function: native_cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002179version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002180attrib: const
2181w: 1, 2, 3, 4
2182t: f16
2183ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002184arg: #2#1 v, range(-100,100)
2185# Absolute error of 2^-11, i.e. 0.00048828125
2186test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002187end:
2188
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002189function: native_divide
2190version: 21
2191attrib: const
2192w: 1, 2, 3, 4
2193t: f32
2194ret: #2#1
2195arg: #2#1 left_vector
2196arg: #2#1 right_vector
2197summary: Approximate division
2198description:
2199 Computes the approximate division of two values.
2200end:
2201
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002202function: native_divide
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002203version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002204attrib: const
2205w: 1, 2, 3, 4
2206t: f16
2207ret: #2#1
2208arg: #2#1 left_vector
2209arg: #2#1 right_vector
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002210end:
2211
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002212function: native_exp
2213version: 18
2214attrib: const
2215w: 1, 2, 3, 4
2216t: f32
2217ret: #2#1
2218arg: #2#1 v, range(-86,86)
2219summary: Approximate e raised to a number
2220description:
2221 Fast approximate exp.
2222
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002223 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2224 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002225
2226 See also @exp().
2227test: limited
2228end:
2229
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002230function: native_exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002231version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002232attrib: const
2233w: 1, 2, 3, 4
2234t: f16
2235ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002236arg: #2#1 v, range(-86,86)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002237end:
2238
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002239function: native_exp10
2240version: 18
2241attrib: const
2242w: 1, 2, 3, 4
2243t: f32
2244ret: #2#1
2245arg: #2#1 v, range(-37,37)
2246summary: Approximate 10 raised to a number
2247description:
2248 Fast approximate exp10.
2249
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002250 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2251 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002252
2253 See also @exp10().
2254test: limited
2255end:
2256
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002257function: native_exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002258version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002259attrib: const
2260w: 1, 2, 3, 4
2261t: f16
2262ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002263arg: #2#1 v, range(-37,37)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002264end:
2265
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002266function: native_exp2
2267version: 18
2268attrib: const
2269w: 1, 2, 3, 4
2270t: f32
2271ret: #2#1
2272arg: #2#1 v, range(-125,125)
2273summary: Approximate 2 raised to a number
2274description:
2275 Fast approximate exp2.
2276
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002277 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2278 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002279
2280 See also @exp2().
2281test: limited
2282end:
2283
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002284function: native_exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002285version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002286attrib: const
2287w: 1, 2, 3, 4
2288t: f16
2289ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002290arg: #2#1 v, range(-125,125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002291end:
2292
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002293function: native_expm1
2294version: 21
2295attrib: const
2296w: 1, 2, 3, 4
2297t: f32
2298ret: #2#1
2299arg: #2#1 v
2300summary: Approximate e raised to a number minus one
2301description:
2302 Returns the approximate (e ^ v) - 1.
2303
2304 See also @expm1().
2305end:
2306
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002307function: native_expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002308version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002309attrib: const
2310w: 1, 2, 3, 4
2311t: f16
2312ret: #2#1
2313arg: #2#1 v
2314test: none
2315end:
2316
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002317function: native_hypot
2318version: 21
2319attrib: const
2320w: 1, 2, 3, 4
2321t: f32
2322ret: #2#1
2323arg: #2#1 a
2324arg: #2#1 b
2325summary: Approximate hypotenuse
2326description:
2327 Returns the approximate native_sqrt(a * a + b * b)
2328
2329 See also @hypot().
2330end:
2331
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002332function: native_hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002333version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002334attrib: const
2335w: 1, 2, 3, 4
2336t: f16
2337ret: #2#1
2338arg: #2#1 a
2339arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002340end:
2341
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002342function: native_log
2343version: 18
2344attrib: const
2345w: 1, 2, 3, 4
2346t: f32
2347ret: #2#1
2348arg: #2#1 v, range(10e-10,10e10)
2349summary: Approximate natural logarithm
2350description:
2351 Fast approximate log.
2352
2353 It is not accurate for values very close to zero.
2354
2355 See also @log().
2356test: limited
2357end:
2358
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002359function: native_log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002360version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002361attrib: const
2362w: 1, 2, 3, 4
2363t: f16
2364ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002365arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002366end:
2367
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002368function: native_log10
2369version: 18
2370attrib: const
2371w: 1, 2, 3, 4
2372t: f32
2373ret: #2#1
2374arg: #2#1 v, range(10e-10,10e10)
2375summary: Approximate base 10 logarithm
2376description:
2377 Fast approximate log10.
2378
2379 It is not accurate for values very close to zero.
2380
2381 See also @log10().
2382test: limited
2383end:
2384
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002385function: native_log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002386version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002387attrib: const
2388w: 1, 2, 3, 4
2389t: f16
2390ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002391arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002392end:
2393
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002394function: native_log1p
2395version: 21
2396attrib: const
2397w: 1, 2, 3, 4
2398t: f32
2399ret: #2#1
2400arg: #2#1 v
2401summary: Approximate natural logarithm of a value plus 1
2402description:
2403 Returns the approximate natural logarithm of (v + 1.0f)
2404
2405 See also @log1p().
2406end:
2407
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002408function: native_log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002409version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002410attrib: const
2411w: 1, 2, 3, 4
2412t: f16
2413ret: #2#1
2414arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002415end:
2416
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002417function: native_log2
2418version: 18
2419attrib: const
2420w: 1, 2, 3, 4
2421t: f32
2422ret: #2#1
2423arg: #2#1 v, range(10e-10,10e10)
2424summary: Approximate base 2 logarithm
2425description:
2426 Fast approximate log2.
2427
2428 It is not accurate for values very close to zero.
2429
2430 See also @log2().
2431test: limited
2432end:
2433
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002434function: native_log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002435version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002436attrib: const
2437w: 1, 2, 3, 4
2438t: f16
2439ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002440arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002441end:
2442
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002443function: native_powr
2444version: 18
2445attrib: const
2446w: 1, 2, 3, 4
2447t: f32
2448ret: #2#1
2449arg: #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."
2450arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2451summary: Approximate positive base raised to an exponent
2452description:
2453 Fast approximate (base ^ exponent).
2454
2455 See also @powr().
2456test: limited
2457end:
2458
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002459function: native_powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002460version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002461attrib: const
2462w: 1, 2, 3, 4
2463t: f16
2464ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002465arg: #2#1 base, range(0,256)
2466arg: #2#1 exponent, range(-15,15)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002467end:
2468
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002469function: native_recip
2470version: 21
2471attrib: const
2472w: 1, 2, 3, 4
2473t: f32
2474ret: #2#1
2475arg: #2#1 v
2476summary: Approximate reciprocal
2477description:
2478 Returns the approximate approximate reciprocal of a value.
2479
2480 See also @half_recip().
2481end:
2482
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002483function: native_recip
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002484version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002485attrib: const
2486w: 1, 2, 3, 4
2487t: f16
2488ret: #2#1
2489arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002490end:
2491
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002492function: native_rootn
2493version: 21
2494attrib: const
2495w: 1, 2, 3, 4
2496t: f32
2497ret: #2#1
2498arg: #2#1 v
2499arg: int#1 n
2500summary: Approximate nth root
2501description:
2502 Compute the approximate Nth root of a value.
2503
2504 See also @rootn().
2505end:
2506
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002507function: native_rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002508version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002509attrib: const
2510w: 1, 2, 3, 4
2511t: f16
2512ret: #2#1
2513arg: #2#1 v
2514arg: int#1 n
2515test: none
2516end:
2517
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002518function: native_rsqrt
2519version: 21
2520attrib: const
2521w: 1, 2, 3, 4
2522t: f32
2523ret: #2#1
2524arg: #2#1 v
2525summary: Approximate reciprocal of a square root
2526description:
2527 Returns approximate (1 / sqrt(v)).
2528
2529 See also @rsqrt(), @half_rsqrt().
2530end:
2531
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002532function: native_rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002533version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002534attrib: const
2535w: 1, 2, 3, 4
2536t: f16
2537ret: #2#1
2538arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002539end:
2540
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002541function: native_sin
2542version: 21
2543attrib: const
2544w: 1, 2, 3, 4
2545t: f32
2546ret: #2#1
2547arg: #2#1 v
2548summary: Approximate sine
2549description:
2550 Returns the approximate sine of an angle measured in radians.
2551
2552 See also @sin().
2553end:
2554
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002555function: native_sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002556version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002557attrib: const
2558w: 1, 2, 3, 4
2559t: f16
2560ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002561arg: #2#1 v, range(-314,314)
2562# Absolute error of 2^-11, i.e. 0.00048828125
2563test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002564end:
2565
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002566function: native_sincos
2567version: 21
2568w: 1, 2, 3, 4
2569t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002570ret: #2#1, "Sine."
2571arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002572arg: #2#1* cos, "*cos will be set to the cosine value."
2573summary: Approximate sine and cosine
2574description:
2575 Returns the approximate sine and cosine of a value.
2576
2577 See also @sincos().
2578# TODO Temporary
2579test: limited(0.0005)
2580end:
2581
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002582function: native_sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002583version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002584w: 1, 2, 3, 4
2585t: f16
2586ret: #2#1
2587arg: #2#1 v
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002588arg: #2#1* cos, range(-314,314)
2589# Absolute error of 2^-11, i.e. 0.00048828125
2590test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002591end:
2592
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002593function: native_sinh
2594version: 21
2595attrib: const
2596w: 1, 2, 3, 4
2597t: f32
2598ret: #2#1
2599arg: #2#1 v
2600summary: Approximate hyperbolic sine
2601description:
2602 Returns the approximate hyperbolic sine of a value specified in radians.
2603
2604 See also @sinh().
2605end:
2606
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002607function: native_sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002608version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002609attrib: const
2610w: 1, 2, 3, 4
2611t: f16
2612ret: #2#1
2613arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002614end:
2615
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002616function: native_sinpi
2617version: 21
2618attrib: const
2619w: 1, 2, 3, 4
2620t: f32
2621ret: #2#1
2622arg: #2#1 v
2623summary: Approximate sine of a number multiplied by pi
2624description:
2625 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2626
2627 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2628
2629 See also @sinpi().
2630end:
2631
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002632function: native_sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002633version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002634attrib: const
2635w: 1, 2, 3, 4
2636t: f16
2637ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002638arg: #2#1 v, range(-100,100)
2639# Absolute error of 2^-11, i.e. 0.00048828125
2640test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002641end:
2642
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002643function: native_sqrt
2644version: 21
2645attrib: const
2646w: 1, 2, 3, 4
2647t: f32
2648ret: #2#1
2649arg: #2#1 v
2650summary: Approximate square root
2651description:
2652 Returns the approximate sqrt(v).
2653
2654 See also @sqrt(), @half_sqrt().
2655end:
2656
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002657function: native_sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002658version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002659attrib: const
2660w: 1, 2, 3, 4
2661t: f16
2662ret: #2#1
2663arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002664end:
2665
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002666function: native_tan
2667version: 21
2668attrib: const
2669w: 1, 2, 3, 4
2670t: f32
2671ret: #2#1
2672arg: #2#1 v
2673summary: Approximate tangent
2674description:
2675 Returns the approximate tangent of an angle measured in radians.
2676end:
2677
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002678function: native_tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002679version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002680attrib: const
2681w: 1, 2, 3, 4
2682t: f16
2683ret: #2#1
2684arg: #2#1 v
2685test: none
2686end:
2687
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002688function: native_tanh
2689version: 21
2690attrib: const
2691w: 1, 2, 3, 4
2692t: f32
2693ret: #2#1
2694arg: #2#1 v
2695summary: Approximate hyperbolic tangent
2696description:
2697 Returns the approximate hyperbolic tangent of a value.
2698
2699 See also @tanh().
2700end:
2701
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002702function: native_tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002703version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002704attrib: const
2705w: 1, 2, 3, 4
2706t: f16
2707ret: #2#1
2708arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002709end:
2710
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002711function: native_tanpi
2712version: 21
2713attrib: const
2714w: 1, 2, 3, 4
2715t: f32
2716ret: #2#1
2717arg: #2#1 v
2718summary: Approximate tangent of a number multiplied by pi
2719description:
2720 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2721
2722 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2723
2724 See also @tanpi().
2725end:
2726
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002727function: native_tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002728version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002729attrib: const
2730w: 1, 2, 3, 4
2731t: f16
2732ret: #2#1
2733arg: #2#1 v
2734test: none
2735end:
2736
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002737function: nextafter
2738version: 9
2739attrib: const
2740w: 1, 2, 3, 4
2741t: f32
2742ret: #2#1
2743arg: #2#1 v
2744arg: #2#1 target
2745summary: Next floating point number
2746description:
2747 Returns the next representable floating point number from v towards target.
2748
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002749 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2750 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002751end:
2752
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002753function: nextafter
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002754version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002755attrib: const
2756w: 1, 2, 3, 4
2757t: f16
2758ret: #2#1
2759arg: #2#1 v
2760arg: #2#1 target
2761test: none
2762end:
2763
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002764function: pow
2765version: 9
2766attrib: const
2767w: 1, 2, 3, 4
2768t: f32
2769ret: #2#1
2770arg: #2#1 base
2771arg: #2#1 exponent
2772summary: Base raised to an exponent
2773description:
2774 Returns base raised to the power exponent, i.e. base ^ exponent.
2775
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002776 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2777 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002778end:
2779
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002780function: pow
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002781version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002782attrib: const
2783w: 1, 2, 3, 4
2784t: f16
2785ret: #2#1
2786arg: #2#1 base
2787arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002788end:
2789
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002790function: pown
2791version: 9
2792attrib: const
2793w: 1, 2, 3, 4
2794t: f32
2795ret: #2#1
2796arg: #2#1 base
2797arg: int#1 exponent
2798summary: Base raised to an integer exponent
2799description:
2800 Returns base raised to the power exponent, i.e. base ^ exponent.
2801
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002802 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2803 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002804end:
2805
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002806function: pown
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002807version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002808attrib: const
2809w: 1, 2, 3, 4
2810t: f16
2811ret: #2#1
2812arg: #2#1 base
2813arg: int#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002814end:
2815
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002816function: powr
2817version: 9
2818attrib: const
2819w: 1, 2, 3, 4
2820t: f32
2821ret: #2#1
2822arg: #2#1 base, range(0,3000)
2823arg: #2#1 exponent
2824summary: Positive base raised to an exponent
2825description:
2826 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2827
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002828 @pow() and @pown() are similar. They both make no assumptions about the base.
2829 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002830
2831 See also @native_powr().
2832end:
2833
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002834function: powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002835version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002836attrib: const
2837w: 1, 2, 3, 4
2838t: f16
2839ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -07002840arg: #2#1 base, range(0,300)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002841arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002842end:
2843
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002844function: radians
2845version: 9
2846attrib: const
2847w: 1, 2, 3, 4
2848t: f32
2849ret: #2#1
2850arg: #2#1 v
2851summary: Converts degrees into radians
2852description:
2853 Converts from degrees to radians.
2854end:
2855
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002856function: radians
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002857version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002858attrib: const
2859w: 1, 2, 3, 4
2860t: f16
2861ret: #2#1
2862arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002863end:
2864
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002865function: remainder
2866version: 9
2867attrib: const
2868w: 1, 2, 3, 4
2869t: f32
2870ret: #2#1
2871arg: #2#1 numerator
2872arg: #2#1 denominator
2873summary: Remainder of a division
2874description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002875 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2876 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002877
2878 The function @fmod() is similar but rounds toward the closest interger.
2879 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2880 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2881end:
2882
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002883function: remainder
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002884version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002885attrib: const
2886w: 1, 2, 3, 4
2887t: f16
2888ret: #2#1
2889arg: #2#1 numerator
2890arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002891end:
2892
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002893function: remquo
2894version: 9
2895w: 1, 2, 3, 4
2896t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002897ret: #2#1, "Remainder, precise only for the low three bits."
2898arg: #2#1 numerator, "Numerator."
2899arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002900arg: int#1* quotient, "*quotient will be set to the integer quotient."
2901summary: Remainder and quotient of a division
2902description:
2903 Returns the quotient and the remainder of (numerator / denominator).
2904
2905 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2906
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002907 This function is useful for implementing periodic functions. The low three bits of the
2908 quotient gives the quadrant and the remainder the distance within the quadrant.
2909 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2910 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002911
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002912 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2913 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002914test: custom
2915end:
2916
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002917function: remquo
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002918version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002919w: 1, 2, 3, 4
2920t: f16
2921ret: #2#1
2922arg: #2#1 numerator
2923arg: #2#1 denominator
2924arg: int#1* quotient
2925test: none
2926end:
2927
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002928function: rint
2929version: 9
2930attrib: const
2931w: 1, 2, 3, 4
2932t: f32
2933ret: #2#1
2934arg: #2#1 v
2935summary: Round to even
2936description:
2937 Rounds to the nearest integral value.
2938
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002939 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2940 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2941 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002942
2943 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2944end:
2945
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002946function: rint
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002947version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002948attrib: const
2949w: 1, 2, 3, 4
2950t: f16
2951ret: #2#1
2952arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002953end:
2954
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002955function: rootn
2956version: 9
2957attrib: const
2958w: 1, 2, 3, 4
2959t: f32
2960ret: #2#1
2961arg: #2#1 v
2962arg: int#1 n
2963summary: Nth root
2964description:
2965 Compute the Nth root of a value.
2966
2967 See also @native_rootn().
2968end:
2969
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002970function: rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002971version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002972attrib: const
2973w: 1, 2, 3, 4
2974t: f16
2975ret: #2#1
2976arg: #2#1 v
2977arg: int#1 n
2978test: none
2979end:
2980
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002981function: round
2982version: 9
2983attrib: const
2984w: 1, 2, 3, 4
2985t: f32
2986ret: #2#1
2987arg: #2#1 v
2988summary: Round away from zero
2989description:
2990 Round to the nearest integral value.
2991
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002992 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
2993 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
2994 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002995
2996 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
2997end:
2998
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002999function: round
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003000version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003001attrib: const
3002w: 1, 2, 3, 4
3003t: f16
3004ret: #2#1
3005arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003006end:
3007
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003008function: rsqrt
3009version: 9
3010attrib: const
3011w: 1, 2, 3, 4
3012t: f32
3013ret: #2#1
3014arg: #2#1 v
3015summary: Reciprocal of a square root
3016description:
3017 Returns (1 / sqrt(v)).
3018
3019 See also @half_rsqrt(), @native_rsqrt().
3020end:
3021
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003022function: rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003023version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003024attrib: const
3025w: 1, 2, 3, 4
3026t: f16
3027ret: #2#1
3028arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003029end:
3030
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003031function: sign
3032version: 9
3033attrib: const
3034w: 1, 2, 3, 4
3035t: f32
3036ret: #2#1
3037arg: #2#1 v
3038summary: Sign of a value
3039description:
3040 Returns the sign of a value.
3041
3042 if (v &lt; 0) return -1.f;
3043 else if (v &gt; 0) return 1.f;
3044 else return 0.f;
3045end:
3046
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003047function: sign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003048version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003049attrib: const
3050w: 1, 2, 3, 4
3051t: f16
3052ret: #2#1
3053arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003054end:
3055
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003056function: sin
3057version: 9
3058attrib: const
3059w: 1, 2, 3, 4
3060t: f32
3061ret: #2#1
3062arg: #2#1 v
3063summary: Sine
3064description:
3065 Returns the sine of an angle measured in radians.
3066
3067 See also @native_sin().
3068end:
3069
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003070function: sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003071version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003072attrib: const
3073w: 1, 2, 3, 4
3074t: f16
3075ret: #2#1
3076arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003077end:
3078
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003079function: sincos
3080version: 9
3081w: 1, 2, 3, 4
3082t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003083ret: #2#1, "Sine of v."
3084arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003085arg: #2#1* cos, "*cos will be set to the cosine value."
3086summary: Sine and cosine
3087description:
3088 Returns the sine and cosine of a value.
3089
3090 See also @native_sincos().
3091end:
3092
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003093function: sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003094version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003095w: 1, 2, 3, 4
3096t: f16
3097ret: #2#1
3098arg: #2#1 v
3099arg: #2#1* cos
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003100end:
3101
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003102function: sinh
3103version: 9
3104attrib: const
3105w: 1, 2, 3, 4
3106t: f32
3107ret: #2#1
3108arg: #2#1 v
3109summary: Hyperbolic sine
3110description:
3111 Returns the hyperbolic sine of v, where v is measured in radians.
3112
3113 See also @native_sinh().
3114end:
3115
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003116function: sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003117version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003118attrib: const
3119w: 1, 2, 3, 4
3120t: f16
3121ret: #2#1
3122arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003123end:
3124
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003125function: sinpi
3126version: 9
3127attrib: const
3128w: 1, 2, 3, 4
3129t: f32
3130ret: #2#1
3131arg: #2#1 v
3132summary: Sine of a number multiplied by pi
3133description:
3134 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3135
3136 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3137
3138 See also @native_sinpi().
3139end:
3140
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003141function: sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003142version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003143attrib: const
3144w: 1, 2, 3, 4
3145t: f16
3146ret: #2#1
3147arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003148end:
3149
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003150function: sqrt
3151version: 9
3152attrib: const
3153w: 1, 2, 3, 4
3154t: f32
3155ret: #2#1
3156arg: #2#1 v
3157summary: Square root
3158description:
3159 Returns the square root of a value.
3160
3161 See also @half_sqrt(), @native_sqrt().
3162end:
3163
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003164function: sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003165version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003166attrib: const
3167w: 1, 2, 3, 4
3168t: f16
3169ret: #2#1
3170arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003171end:
3172
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003173function: step
3174version: 9
3175attrib: const
3176w: 1, 2, 3, 4
3177t: f32
3178ret: #2#1
3179arg: #2#1 edge
3180arg: #2#1 v
3181summary: 0 if less than a value, 0 otherwise
3182description:
3183 Returns 0.f if v &lt; edge, 1.f otherwise.
3184
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003185 This can be useful to create conditional computations without using loops and branching
3186 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3187 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 -07003188end:
3189
3190function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003191version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003192attrib: const
3193w: 1, 2, 3, 4
3194t: f16
3195ret: #2#1
3196arg: #2#1 edge
3197arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003198end:
3199
3200function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003201version: 9
3202attrib: const
3203w: 2, 3, 4
3204t: f32
3205ret: #2#1
3206arg: #2#1 edge
3207arg: #2 v
3208end:
3209
3210function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003211version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003212attrib: const
3213w: 2, 3, 4
3214t: f16
3215ret: #2#1
3216arg: #2#1 edge
3217arg: #2 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003218end:
3219
3220function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003221version: 21
3222attrib: const
3223w: 2, 3, 4
3224t: f32
3225ret: #2#1
3226arg: #2 edge
3227arg: #2#1 v
3228end:
3229
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003230function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003231version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003232attrib: const
3233w: 2, 3, 4
3234t: f16
3235ret: #2#1
3236arg: #2 edge
3237arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003238end:
3239
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003240function: tan
3241version: 9
3242attrib: const
3243w: 1, 2, 3, 4
3244t: f32
3245ret: #2#1
3246arg: #2#1 v
3247summary: Tangent
3248description:
3249 Returns the tangent of an angle measured in radians.
3250
3251 See also @native_tan().
3252end:
3253
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003254function: tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003255version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003256attrib: const
3257w: 1, 2, 3, 4
3258t: f16
3259ret: #2#1
3260arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003261end:
3262
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003263function: tanh
3264version: 9
3265attrib: const
3266w: 1, 2, 3, 4
3267t: f32
3268ret: #2#1
3269arg: #2#1 v
3270summary: Hyperbolic tangent
3271description:
3272 Returns the hyperbolic tangent of a value.
3273
3274 See also @native_tanh().
3275end:
3276
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003277function: tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003278version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003279attrib: const
3280w: 1, 2, 3, 4
3281t: f16
3282ret: #2#1
3283arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003284end:
3285
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003286function: tanpi
3287version: 9
3288attrib: const
3289w: 1, 2, 3, 4
3290t: f32
3291ret: #2#1
3292arg: #2#1 v
3293summary: Tangent of a number multiplied by pi
3294description:
3295 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3296
3297 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3298
3299 See also @native_tanpi().
3300end:
3301
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003302function: tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003303version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003304attrib: const
3305w: 1, 2, 3, 4
3306t: f16
3307ret: #2#1
3308arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003309end:
3310
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003311function: tgamma
3312version: 9
3313attrib: const
3314w: 1, 2, 3, 4
3315t: f32
3316ret: #2#1
3317arg: #2#1 v
3318summary: Gamma function
3319description:
3320 Returns the gamma function of a value.
3321
3322 See also @lgamma().
3323end:
3324
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003325function: tgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003326version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003327attrib: const
3328w: 1, 2, 3, 4
3329t: f16
3330ret: #2#1
3331arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003332end:
3333
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003334function: trunc
3335version: 9
3336attrib: const
3337w: 1, 2, 3, 4
3338t: f32
3339ret: #2#1
3340arg: #2#1 v
3341summary: Truncates a floating point
3342description:
3343 Rounds to integral using truncation.
3344
3345 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3346
3347 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003348end:
3349
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003350function: trunc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003351version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003352attrib: const
3353w: 1, 2, 3, 4
3354t: f16
3355ret: #2#1
3356arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003357end:
3358
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003359function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003360attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003361t: i8, i16, i32, u8, u16, u32
3362ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003363arg: #1 amount, "Value to clamp."
3364arg: #1 low, "Lower bound."
3365arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003366deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003367summary: Restrain a value to a range
3368description:
3369 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003370test: none
3371end:
3372
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003373function: rsFrac
3374attrib: const
3375ret: float
3376arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003377deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003378summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003379description:
3380 Returns the fractional part of a float
3381test: none
3382end:
3383
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003384function: rsRand
3385ret: int
3386arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003387summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003388description:
3389 Return a random value between 0 (or min_value) and max_malue.
3390test: none
3391end:
3392
3393function: rsRand
3394ret: int
3395arg: int min_value
3396arg: int max_value
3397test: none
3398end:
3399
3400function: rsRand
3401ret: float
3402arg: float max_value
3403test: none
3404end:
3405
3406function: rsRand
3407ret: float
3408arg: float min_value
3409arg: float max_value
3410test: none
3411end: