blob: 15378ad8f035db038f15c28f294375c9a6d41ef4 [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
David Grosscb25a812017-02-10 15:10:52 -080054type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070055summary: 1 / pi, as a 32 bit float
56description:
57 The inverse of pi, as a 32 bit float.
58end:
59
60constant: M_2_PI
61value: 0.636619772367581343075535053490057448f
David Grosscb25a812017-02-10 15:10:52 -080062type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070063summary: 2 / pi, as a 32 bit float
64description:
65 2 divided by pi, as a 32 bit float.
66end:
67
68constant: M_2_PIl
69value: 0.636619772367581343075535053490057448f
David Grosscb25a812017-02-10 15:10:52 -080070type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070071hidden:
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -070072deprecated: 22, Use M_2_PI instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070073summary: 2 / pi, as a 32 bit float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070074description:
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070075 2 divided by pi, as a 32 bit float.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070076end:
77
78constant: M_2_SQRTPI
79value: 1.128379167095512573896158903121545172f
David Grosscb25a812017-02-10 15:10:52 -080080type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070081summary: 2 / sqrt(pi), as a 32 bit float
82description:
83 2 divided by the square root of pi, as a 32 bit float.
84end:
85
86constant: M_E
87value: 2.718281828459045235360287471352662498f
David Grosscb25a812017-02-10 15:10:52 -080088type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070089summary: e, as a 32 bit float
90description:
91 The number e, the base of the natural logarithm, as a 32 bit float.
92end:
93
94constant: M_LN10
95value: 2.302585092994045684017991454684364208f
David Grosscb25a812017-02-10 15:10:52 -080096type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070097summary: log_e(10), as a 32 bit float
98description:
99 The natural logarithm of 10, as a 32 bit float.
100end:
101
102constant: M_LN2
103value: 0.693147180559945309417232121458176568f
David Grosscb25a812017-02-10 15:10:52 -0800104type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700105summary: log_e(2), as a 32 bit float
106description:
107 The natural logarithm of 2, as a 32 bit float.
108end:
109
110constant: M_LOG10E
111value: 0.434294481903251827651128918916605082f
David Grosscb25a812017-02-10 15:10:52 -0800112type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700113summary: log_10(e), as a 32 bit float
114description:
115 The logarithm base 10 of e, as a 32 bit float.
116end:
117
118constant: M_LOG2E
119value: 1.442695040888963407359924681001892137f
David Grosscb25a812017-02-10 15:10:52 -0800120type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700121summary: log_2(e), as a 32 bit float
122description:
123 The logarithm base 2 of e, as a 32 bit float.
124end:
125
126constant: M_PI
127value: 3.141592653589793238462643383279502884f
David Grosscb25a812017-02-10 15:10:52 -0800128type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700129summary: pi, as a 32 bit float
130description:
131 The constant pi, as a 32 bit float.
132end:
133
134constant: M_PI_2
135value: 1.570796326794896619231321691639751442f
David Grosscb25a812017-02-10 15:10:52 -0800136type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700137summary: pi / 2, as a 32 bit float
138description:
139 Pi divided by 2, as a 32 bit float.
140end:
141
142constant: M_PI_4
143value: 0.785398163397448309615660845819875721f
David Grosscb25a812017-02-10 15:10:52 -0800144type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700145summary: pi / 4, as a 32 bit float
146description:
147 Pi divided by 4, as a 32 bit float.
148end:
149
150constant: M_SQRT1_2
151value: 0.707106781186547524400844362104849039f
David Grosscb25a812017-02-10 15:10:52 -0800152type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700153summary: 1 / sqrt(2), as a 32 bit float
154description:
155 The inverse of the square root of 2, as a 32 bit float.
156end:
157
158constant: M_SQRT2
159value: 1.414213562373095048801688724209698079f
David Grosscb25a812017-02-10 15:10:52 -0800160type: float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700161summary: sqrt(2), as a 32 bit float
162description:
163 The square root of 2, as a 32 bit float.
164end:
165
166function: abs
167version: 9
168attrib: const
169w: 1, 2, 3, 4
170t: i8, i16, i32
171ret: u#2#1
172arg: #2#1 v
173summary: Absolute value of an integer
174description:
175 Returns the absolute value of an integer.
176
177 For floats, use @fabs().
178end:
179
180function: acos
181version: 9
182attrib: const
183w: 1, 2, 3, 4
184t: f32
185ret: #2#1
186arg: #2#1 v, range(-1,1)
187summary: Inverse cosine
188description:
189 Returns the inverse cosine, in radians.
190
191 See also @native_acos().
192end:
193
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800194function: acos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800195version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800196attrib: const
197w: 1, 2, 3, 4
198t: f16
199ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700200arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800201end:
202
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700203function: acosh
204version: 9
205attrib: const
206w: 1, 2, 3, 4
207t: f32
208ret: #2#1
209arg: #2#1 v
210summary: Inverse hyperbolic cosine
211description:
212 Returns the inverse hyperbolic cosine, in radians.
213
214 See also @native_acosh().
215end:
216
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800217function: acosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800218version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800219attrib: const
220w: 1, 2, 3, 4
221t: f16
222ret: #2#1
223arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800224end:
225
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700226function: acospi
227version: 9
228attrib: const
229w: 1, 2, 3, 4
230t: f32
231ret: #2#1
232arg: #2#1 v, range(-1,1)
233summary: Inverse cosine divided by pi
234description:
235 Returns the inverse cosine in radians, divided by pi.
236
237 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
238
239 See also @native_acospi().
240end:
241
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800242function: acospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800243version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800244attrib: const
245w: 1, 2, 3, 4
246t: f16
247ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700248arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800249end:
250
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700251function: asin
252version: 9
253attrib: const
254w: 1, 2, 3, 4
255t: f32
256ret: #2#1
257arg: #2#1 v, range(-1,1)
258summary: Inverse sine
259description:
260 Returns the inverse sine, in radians.
261
262 See also @native_asin().
263end:
264
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800265function: asin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800266version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800267attrib: const
268w: 1, 2, 3, 4
269t: f16
270ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700271arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800272end:
273
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700274function: asinh
275version: 9
276attrib: const
277w: 1, 2, 3, 4
278t: f32
279ret: #2#1
280arg: #2#1 v
281summary: Inverse hyperbolic sine
282description:
283 Returns the inverse hyperbolic sine, in radians.
284
285 See also @native_asinh().
286end:
287
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800288function: asinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800289version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800290attrib: const
291w: 1, 2, 3, 4
292t: f16
293ret: #2#1
294arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800295end:
296
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700297function: asinpi
298version: 9
299attrib: const
300w: 1, 2, 3, 4
301t: f32
302ret: #2#1
303arg: #2#1 v, range(-1,1)
304summary: Inverse sine divided by pi
305description:
306 Returns the inverse sine in radians, divided by pi.
307
308 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
309
310 See also @native_asinpi().
311end:
312
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800313function: asinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800314version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800315attrib: const
316w: 1, 2, 3, 4
317t: f16
318ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700319arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800320end:
321
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700322function: atan
323version: 9
324attrib: const
325w: 1, 2, 3, 4
326t: f32
327ret: #2#1
328arg: #2#1 v, range(-1,1)
329summary: Inverse tangent
330description:
331 Returns the inverse tangent, in radians.
332
333 See also @native_atan().
334end:
335
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800336function: atan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800337version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800338attrib: const
339w: 1, 2, 3, 4
340t: f16
341ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700342arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800343end:
344
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700345function: atan2
346version: 9
347attrib: const
348w: 1, 2, 3, 4
349t: f32
350ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700351arg: #2#1 numerator, "Numerator."
352arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700353summary: Inverse tangent of a ratio
354description:
355 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians.
356
357 See also @native_atan2().
358end:
359
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800360function: atan2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800361version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800362attrib: const
363w: 1, 2, 3, 4
364t: f16
365ret: #2#1
366arg: #2#1 numerator
367arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800368end:
369
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700370function: atan2pi
371version: 9
372attrib: const
373w: 1, 2, 3, 4
374t: f32
375ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700376arg: #2#1 numerator, "Numerator."
377arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700378summary: Inverse tangent of a ratio, divided by pi
379description:
380 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians, divided by pi.
381
382 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
383
384 See also @native_atan2pi().
385end:
386
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800387function: atan2pi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800388version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800389attrib: const
390w: 1, 2, 3, 4
391t: f16
392ret: #2#1
393arg: #2#1 numerator
394arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800395end:
396
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700397function: atanh
398version: 9
399attrib: const
400w: 1, 2, 3, 4
401t: f32
402ret: #2#1
403arg: #2#1 v, range(-1,1)
404summary: Inverse hyperbolic tangent
405description:
406 Returns the inverse hyperbolic tangent, in radians.
407
408 See also @native_atanh().
409end:
410
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800411function: atanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800412version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800413attrib: const
414w: 1, 2, 3, 4
415t: f16
416ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700417arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800418end:
419
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700420function: atanpi
421version: 9
422attrib: const
423w: 1, 2, 3, 4
424t: f32
425ret: #2#1
426arg: #2#1 v, range(-1,1)
427summary: Inverse tangent divided by pi
428description:
429 Returns the inverse tangent in radians, divided by pi.
430
431 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
432
433 See also @native_atanpi().
434end:
435
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800436function: atanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800437version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800438attrib: const
439w: 1, 2, 3, 4
440t: f16
441ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -0700442arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800443end:
444
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700445function: cbrt
446version: 9
447attrib: const
448w: 1, 2, 3, 4
449t: f32
450ret: #2#1
451arg: #2#1 v
452summary: Cube root
453description:
454 Returns the cube root.
455
456 See also @native_cbrt().
457end:
458
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800459function: cbrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800460version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800461attrib: const
462w: 1, 2, 3, 4
463t: f16
464ret: #2#1
465arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800466end:
467
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700468function: ceil
469version: 9
470attrib: const
471w: 1, 2, 3, 4
472t: f32
473ret: #2#1
474arg: #2#1 v
475summary: Smallest integer not less than a value
476description:
477 Returns the smallest integer not less than a value.
478
479 For example, <code>ceil(1.2f)</code> returns 2.f, and <code>ceil(-1.2f)</code> returns -1.f.
480
481 See also @floor().
482end:
483
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800484function: ceil
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800485version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800486attrib: const
487w: 1, 2, 3, 4
488t: f16
489ret: #2#1
490arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800491end:
492
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700493function: clamp
494version: 9
495attrib: const
496w: 1, 2, 3, 4
497t: f32
498ret: #2#1
499arg: #2#1 value, "Value to be clamped."
500arg: #2#1 min_value, "Lower bound, a scalar or matching vector."
501arg: #2#1 max_value, above(min_value), "High bound, must match the type of low."
502summary: Restrain a value to a range
503description:
504 Clamps a value to a specified high and low bound. clamp() returns min_value
505 if value &lt; min_value, max_value if value &gt; max_value, otherwise value.
506
507 There are two variants of clamp: one where the min and max are scalars applied
508 to all entries of the value, the other where the min and max are also vectors.
509
510 If min_value is greater than max_value, the results are undefined.
511end:
512
513function: clamp
514version: 9
515attrib: const
516w: 2, 3, 4
517t: f32
518ret: #2#1
519arg: #2#1 value
520arg: #2 min_value
521arg: #2 max_value, above(min_value)
522end:
523
524function: clamp
525version: 19
526attrib: const
527w: 1, 2, 3, 4
528t: u8, u16, u32, u64, i8, i16, i32, i64
529ret: #2#1
530arg: #2#1 value
531arg: #2#1 min_value
532arg: #2#1 max_value, above(min_value)
533end:
534
535function: clamp
536version: 19
537attrib: const
538w: 2, 3, 4
539t: u8, u16, u32, u64, i8, i16, i32, i64
540ret: #2#1
541arg: #2#1 value
542arg: #2 min_value
543arg: #2 max_value, above(min_value)
544end:
545
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800546function: clamp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800547version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800548attrib: const
549w: 1, 2, 3, 4
550t: f16
551ret: #2#1
552arg: #2#1 value
553arg: #2#1 min_value
554arg: #2#1 max_value, above(min_value)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800555end:
556
557function: clamp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800558version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800559attrib: const
560w: 2, 3, 4
561t: f16
562ret: #2#1
563arg: #2#1 value
564arg: #2 min_value
565arg: #2 max_value, above(min_value)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800566end:
567
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700568function: clz
569version: 9
570attrib: const
571w: 1, 2, 3, 4
572t: u8, u16, u32, i8, i16, i32
573ret: #2#1
574arg: #2#1 value
575summary: Number of leading 0 bits
576description:
577 Returns the number of leading 0-bits in a value.
578
579 For example, <code>clz((char)0x03)</code> returns 6.
580end:
581
582function: copysign
583version: 9
584attrib: const
585w: 1, 2, 3, 4
586t: f32
587ret: #2#1
588arg: #2#1 magnitude_value
589arg: #2#1 sign_value
590summary: Copies the sign of a number to another
591description:
592 Copies the sign from sign_value to magnitude_value.
593
594 The value returned is either magnitude_value or -magnitude_value.
595
596 For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
597end:
598
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800599function: copysign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800600version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800601attrib: const
602w: 1, 2, 3, 4
603t: f16
604ret: #2#1
605arg: #2#1 magnitude_value
606arg: #2#1 sign_value
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800607end:
608
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700609function: cos
610version: 9
611attrib: const
612w: 1, 2, 3, 4
613t: f32
614ret: #2#1
615arg: #2#1 v
616summary: Cosine
617description:
618 Returns the cosine of an angle measured in radians.
619
620 See also @native_cos().
621end:
622
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800623function: cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800624version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800625attrib: const
626w: 1, 2, 3, 4
627t: f16
628ret: #2#1
629arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800630end:
631
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700632function: cosh
633version: 9
634attrib: const
635w: 1, 2, 3, 4
636t: f32
637ret: #2#1
638arg: #2#1 v
639summary: Hypebolic cosine
640description:
641 Returns the hypebolic cosine of v, where v is measured in radians.
642
643 See also @native_cosh().
644end:
645
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800646function: cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800647version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800648attrib: const
649w: 1, 2, 3, 4
650t: f16
651ret: #2#1
652arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800653end:
654
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700655function: cospi
656version: 9
657attrib: const
658w: 1, 2, 3, 4
659t: f32
660ret: #2#1
661arg: #2#1 v
662summary: Cosine of a number multiplied by pi
663description:
664 Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
665
666 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
667
668 See also @native_cospi().
669end:
670
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800671function: cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800672version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800673attrib: const
674w: 1, 2, 3, 4
675t: f16
676ret: #2#1
677arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800678end:
679
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700680function: degrees
681version: 9
682attrib: const
683w: 1, 2, 3, 4
684t: f32
685ret: #2#1
686arg: #2#1 v
687summary: Converts radians into degrees
688description:
689 Converts from radians to degrees.
690end:
691
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800692function: degrees
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800693version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800694attrib: const
695w: 1, 2, 3, 4
696t: f16
697ret: #2#1
698arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800699end:
700
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700701function: erf
702version: 9
703attrib: const
704w: 1, 2, 3, 4
705t: f32
706ret: #2#1
707arg: #2#1 v
708summary: Mathematical error function
709description:
710 Returns the error function.
711end:
712
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800713function: erf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800714version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800715attrib: const
716w: 1, 2, 3, 4
717t: f16
718ret: #2#1
719arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800720end:
721
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700722function: erfc
723version: 9
724attrib: const
725w: 1, 2, 3, 4
726t: f32
727ret: #2#1
728arg: #2#1 v
729summary: Mathematical complementary error function
730description:
731 Returns the complementary error function.
732end:
733
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800734function: erfc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800735version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800736attrib: const
737w: 1, 2, 3, 4
738t: f16
739ret: #2#1
740arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800741end:
742
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700743function: exp
744version: 9
745attrib: const
746w: 1, 2, 3, 4
747t: f32
748ret: #2#1
749arg: #2#1 v
750summary: e raised to a number
751description:
752 Returns e raised to v, i.e. e ^ v.
753
754 See also @native_exp().
755end:
756
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800757function: exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800758version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800759attrib: const
760w: 1, 2, 3, 4
761t: f16
762ret: #2#1
763arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800764end:
765
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700766function: exp10
767version: 9
768attrib: const
769w: 1, 2, 3, 4
770t: f32
771ret: #2#1
772arg: #2#1 v
773summary: 10 raised to a number
774description:
775 Returns 10 raised to v, i.e. 10.f ^ v.
776
777 See also @native_exp10().
778end:
779
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800780function: exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800781version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800782attrib: const
783w: 1, 2, 3, 4
784t: f16
785ret: #2#1
786arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800787end:
788
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700789function: exp2
790version: 9
791attrib: const
792w: 1, 2, 3, 4
793t: f32
794ret: #2#1
795arg: #2#1 v
796summary: 2 raised to a number
797description:
798 Returns 2 raised to v, i.e. 2.f ^ v.
799
800 See also @native_exp2().
801end:
802
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800803function: exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800804version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800805attrib: const
806w: 1, 2, 3, 4
807t: f16
808ret: #2#1
809arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800810end:
811
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700812function: expm1
813version: 9
814attrib: const
815w: 1, 2, 3, 4
816t: f32
817ret: #2#1
818arg: #2#1 v
819summary: e raised to a number minus one
820description:
821 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
822
823 See also @native_expm1().
824end:
825
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800826function: expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800827version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800828attrib: const
829w: 1, 2, 3, 4
830t: f16
831ret: #2#1
832arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800833end:
834
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700835function: fabs
836version: 9
837attrib: const
838w: 1, 2, 3, 4
839t: f32
840ret: #2#1
841arg: #2#1 v
842summary: Absolute value of a float
843description:
844 Returns the absolute value of the float v.
845
846 For integers, use @abs().
847end:
848
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800849function: fabs
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800850version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800851attrib: const
852w: 1, 2, 3, 4
853t: f16
854ret: #2#1
855arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800856end:
857
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700858function: fdim
859version: 9
860attrib: const
861w: 1, 2, 3, 4
862t: f32
863ret: #2#1
864arg: #2#1 a
865arg: #2#1 b
866summary: Positive difference between two values
867description:
868 Returns the positive difference between two values.
869
870 If a &gt; b, returns (a - b) otherwise returns 0f.
871end:
872
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800873function: fdim
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800874version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800875attrib: const
876w: 1, 2, 3, 4
877t: f16
878ret: #2#1
879arg: #2#1 a
880arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800881end:
882
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700883function: floor
884version: 9
885attrib: const
886w: 1, 2, 3, 4
887t: f32
888ret: #2#1
889arg: #2#1 v
890summary: Smallest integer not greater than a value
891description:
892 Returns the smallest integer not greater than a value.
893
894 For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
895
896 See also @ceil().
897end:
898
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800899function: floor
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800900version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800901attrib: const
902w: 1, 2, 3, 4
903t: f16
904ret: #2#1
905arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800906end:
907
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700908function: fma
909version: 9
910attrib: const
911w: 1, 2, 3, 4
912t: f32
913ret: #2#1
914arg: #2#1 multiplicand1
915arg: #2#1 multiplicand2
916arg: #2#1 offset
917summary: Multiply and add
918description:
919 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
920
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700921 This function is similar to @mad(). fma() retains full precision of the multiplied result
922 and rounds only after the addition. @mad() rounds after the multiplication and the addition.
923 This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700924end:
925
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800926function: fma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800927version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800928attrib: const
929w: 1, 2, 3, 4
930t: f16
931ret: #2#1
932arg: #2#1 multiplicand1
933arg: #2#1 multiplicand2
934arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800935end:
936
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700937function: fmax
938version: 9
939attrib: const
940w: 1, 2, 3, 4
941t: f32
942ret: #2#1
943arg: #2#1 a
944arg: #2#1 b
945summary: Maximum of two floats
946description:
947 Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
948
949 The @max() function returns identical results but can be applied to more data types.
950end:
951
952function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800953version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800954attrib: const
955w: 1, 2, 3, 4
956t: f16
957ret: #2#1
958arg: #2#1 a
959arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800960end:
961
962function: fmax
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700963version: 9
964attrib: const
965w: 2, 3, 4
966t: f32
967ret: #2#1
968arg: #2#1 a
969arg: #2 b
970end:
971
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800972function: fmax
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800973version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800974attrib: const
975w: 2, 3, 4
976t: f16
977ret: #2#1
978arg: #2#1 a
979arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800980end:
981
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700982function: fmin
983version: 9
984attrib: const
985w: 1, 2, 3, 4
986t: f32
987ret: #2#1
988arg: #2#1 a
989arg: #2#1 b
990summary: Minimum of two floats
991description:
992 Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
993
994 The @min() function returns identical results but can be applied to more data types.
995end:
996
997function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -0800998version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800999attrib: const
1000w: 1, 2, 3, 4
1001t: f16
1002ret: #2#1
1003arg: #2#1 a
1004arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001005end:
1006
1007function: fmin
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001008version: 9
1009attrib: const
1010w: 2, 3, 4
1011t: f32
1012ret: #2#1
1013arg: #2#1 a
1014arg: #2 b
1015end:
1016
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001017function: fmin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001018version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001019attrib: const
1020w: 2, 3, 4
1021t: f16
1022ret: #2#1
1023arg: #2#1 a
1024arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001025end:
1026
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001027function: fmod
1028version: 9
1029attrib: const
1030w: 1, 2, 3, 4
1031t: f32
1032ret: #2#1
1033arg: #2#1 numerator
1034arg: #2#1 denominator
1035summary: Modulo
1036description:
1037 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1038
1039 The function @remainder() is similar but rounds toward the closest interger.
1040 For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
1041 while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
1042end:
1043
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001044function: fmod
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001045version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001046attrib: const
1047w: 1, 2, 3, 4
1048t: f16
1049ret: #2#1
1050arg: #2#1 numerator
1051arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001052end:
1053
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001054function: fract
1055version: 9
1056w: 1, 2, 3, 4
1057t: f32
1058ret: #2#1
1059arg: #2#1 v, "Input value."
1060arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
1061summary: Positive fractional part
1062description:
1063 Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
1064
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001065 For example, <code>fract(1.3f, &amp;val)</code> returns 0.3f and sets val to 1.f.
1066 <code>fract(-1.3f, &amp;val)</code> returns 0.7f and sets val to -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001067end:
1068
1069function: fract
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001070version: 9 23
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001071attrib: const
1072w: 1, 2, 3, 4
1073t: f32
1074ret: #2#1
1075arg: #2#1 v
1076inline:
1077 #2#1 unused;
1078 return fract(v, &unused);
1079end:
1080
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001081function: fract
1082version: 24
1083w: 1, 2, 3, 4
1084t: f32
1085ret: #2#1
1086arg: #2#1 v
1087end:
1088
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001089function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001090version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001091w: 1, 2, 3, 4
1092t: f16
1093ret: #2#1
1094arg: #2#1 v
1095arg: #2#1* floor
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001096end:
1097
1098function: fract
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001099version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001100w: 1, 2, 3, 4
1101t: f16
1102ret: #2#1
1103arg: #2#1 v
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001104end:
1105
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001106function: frexp
1107version: 9
1108w: 1, 2, 3, 4
1109t: f32
1110ret: #2#1
1111arg: #2#1 v, "Input value."
1112arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1113summary: Binary mantissa and exponent
1114description:
1115 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1116
1117 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1118
1119 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1120end:
1121
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001122function: frexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001123version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001124w: 1, 2, 3, 4
1125t: f16
1126ret: #2#1
1127arg: #2#1 v
1128arg: int#1* exponent
1129test: none
1130end:
1131
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001132function: half_recip
1133version: 17
1134attrib: const
1135w: 1, 2, 3, 4
1136t: f32
1137ret: #2#1
1138arg: #2#1 v
1139summary: Reciprocal computed to 16 bit precision
1140description:
1141 Returns the approximate reciprocal of a value.
1142
1143 The precision is that of a 16 bit floating point value.
1144
1145 See also @native_recip().
1146end:
1147
1148function: half_rsqrt
1149version: 17
1150attrib: const
1151w: 1, 2, 3, 4
1152t: f32
1153ret: #2#1
1154arg: #2#1 v
1155summary: Reciprocal of a square root computed to 16 bit precision
1156description:
1157 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1158
1159 The precision is that of a 16 bit floating point value.
1160
1161 See also @rsqrt(), @native_rsqrt().
1162end:
1163
1164function: half_sqrt
1165version: 17
1166attrib: const
1167w: 1, 2, 3, 4
1168t: f32
1169ret: #2#1
1170arg: #2#1 v
1171summary: Square root computed to 16 bit precision
1172description:
1173 Returns the approximate square root of a value.
1174
1175 The precision is that of a 16 bit floating point value.
1176
1177 See also @sqrt(), @native_sqrt().
1178end:
1179
1180function: hypot
1181version: 9
1182attrib: const
1183w: 1, 2, 3, 4
1184t: f32
1185ret: #2#1
1186arg: #2#1 a
1187arg: #2#1 b
1188summary: Hypotenuse
1189description:
1190 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1191
1192 See also @native_hypot().
1193end:
1194
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001195function: hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001196version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001197attrib: const
1198w: 1, 2, 3, 4
1199t: f16
1200ret: #2#1
1201arg: #2#1 a
1202arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001203end:
1204
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001205function: ilogb
1206version: 9
1207attrib: const
1208w: 1, 2, 3, 4
1209t: f32
1210ret: int#1
1211arg: float#1 v
1212summary: Base two exponent
1213description:
1214 Returns the base two exponent of a value, where the mantissa is between
1215 1.f (inclusive) and 2.f (exclusive).
1216
1217 For example, <code>ilogb(8.5f)</code> returns 3.
1218
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001219 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001220
1221 @logb() is similar but returns a float.
1222test: custom
1223end:
1224
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001225function: ilogb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001226version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001227attrib: const
1228w: 1, 2, 3, 4
1229t: f16
1230ret: int#1
1231arg: half#1 v
1232test: none
1233end:
1234
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001235function: ldexp
1236version: 9
1237attrib: const
1238w: 1, 2, 3, 4
1239ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001240arg: float#1 mantissa, "Mantissa."
1241arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001242summary: Creates a floating point from mantissa and exponent
1243description:
1244 Returns the floating point created from the mantissa and exponent,
1245 i.e. (mantissa * 2 ^ exponent).
1246
1247 See @frexp() for the reverse operation.
1248end:
1249
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001250function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001251version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001252attrib: const
1253w: 1, 2, 3, 4
1254ret: half#1
1255arg: half#1 mantissa
1256arg: int#1 exponent
1257test: none
1258end:
1259
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001260function: ldexp
1261version: 9
1262attrib: const
1263w: 2, 3, 4
1264ret: float#1
1265arg: float#1 mantissa
1266arg: int exponent
1267end:
1268
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001269function: ldexp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001270version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001271attrib: const
1272w: 2, 3, 4
1273ret: half#1
1274arg: half#1 mantissa
1275arg: int exponent
1276test: none
1277end:
1278
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001279function: lgamma
1280version: 9
1281attrib: const
1282w: 1, 2, 3, 4
1283t: f32
1284ret: #2#1
1285arg: #2#1 v
1286summary: Natural logarithm of the gamma function
1287description:
1288 Returns the natural logarithm of the absolute value of the gamma function,
1289 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1290
1291 See also @tgamma().
1292end:
1293
1294function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001295version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001296attrib: const
1297w: 1, 2, 3, 4
1298t: f16
1299ret: #2#1
1300arg: #2#1 v
1301test: none
1302end:
1303
1304function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001305version: 9
1306w: 1, 2, 3, 4
1307t: f32
1308ret: #2#1
1309arg: #2#1 v
1310arg: 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."
1311test: custom
1312#TODO Temporary until bionic & associated drivers are fixed
1313end:
1314
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001315function: lgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001316version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001317w: 1, 2, 3, 4
1318t: f16
1319ret: #2#1
1320arg: #2#1 v
1321arg: int#1* sign_of_gamma
1322test: none
1323end:
1324
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001325function: log
1326version: 9
1327attrib: const
1328w: 1, 2, 3, 4
1329t: f32
1330ret: #2#1
1331arg: #2#1 v
1332summary: Natural logarithm
1333description:
1334 Returns the natural logarithm.
1335
1336 See also @native_log().
1337end:
1338
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001339function: log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001340version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001341attrib: const
1342w: 1, 2, 3, 4
1343t: f16
1344ret: #2#1
1345arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001346end:
1347
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001348function: log10
1349version: 9
1350attrib: const
1351w: 1, 2, 3, 4
1352t: f32
1353ret: #2#1
1354arg: #2#1 v
1355summary: Base 10 logarithm
1356description:
1357 Returns the base 10 logarithm.
1358
1359 See also @native_log10().
1360end:
1361
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001362function: log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001363version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001364attrib: const
1365w: 1, 2, 3, 4
1366t: f16
1367ret: #2#1
1368arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001369end:
1370
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001371function: log1p
1372version: 9
1373attrib: const
1374w: 1, 2, 3, 4
1375t: f32
1376ret: #2#1
1377arg: #2#1 v
1378summary: Natural logarithm of a value plus 1
1379description:
1380 Returns the natural logarithm of <code>(v + 1.f)</code>.
1381
1382 See also @native_log1p().
1383end:
1384
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001385function: log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001386version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001387attrib: const
1388w: 1, 2, 3, 4
1389t: f16
1390ret: #2#1
1391arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001392end:
1393
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001394function: log2
1395version: 9
1396attrib: const
1397w: 1, 2, 3, 4
1398t: f32
1399ret: #2#1
1400arg: #2#1 v
1401summary: Base 2 logarithm
1402description:
1403 Returns the base 2 logarithm.
1404
1405 See also @native_log2().
1406end:
1407
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001408function: log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001409version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001410attrib: const
1411w: 1, 2, 3, 4
1412t: f16
1413ret: #2#1
1414arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001415end:
1416
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001417function: logb
1418version: 9
1419attrib: const
1420w: 1, 2, 3, 4
1421t: f32
1422ret: #2#1
1423arg: #2#1 v
1424summary: Base two exponent
1425description:
1426 Returns the base two exponent of a value, where the mantissa is between
1427 1.f (inclusive) and 2.f (exclusive).
1428
1429 For example, <code>logb(8.5f)</code> returns 3.f.
1430
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001431 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001432
1433 @ilogb() is similar but returns an integer.
1434end:
1435
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001436function: logb
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001437version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001438attrib: const
1439w: 1, 2, 3, 4
1440t: f16
1441ret: #2#1
1442arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001443end:
1444
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001445function: mad
1446version: 9
1447attrib: const
1448w: 1, 2, 3, 4
1449t: f32
1450ret: #2#1
1451arg: #2#1 multiplicand1
1452arg: #2#1 multiplicand2
1453arg: #2#1 offset
1454summary: Multiply and add
1455description:
1456 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1457
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001458 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1459 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1460 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001461end:
1462
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001463function: mad
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001464version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001465attrib: const
1466w: 1, 2, 3, 4
1467t: f16
1468ret: #2#1
1469arg: #2#1 multiplicand1
1470arg: #2#1 multiplicand2
1471arg: #2#1 offset
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001472end:
1473
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001474function: max
1475version: 9
1476attrib: const
1477w: 1, 2, 3, 4
1478t: f32
1479ret: #2#1
1480arg: #2#1 a
1481arg: #2#1 b
1482summary: Maximum
1483description:
1484 Returns the maximum value of two arguments.
1485end:
1486
1487function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001488version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001489attrib: const
1490w: 1, 2, 3, 4
1491t: f16
1492ret: #2#1
1493arg: #2#1 a
1494arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001495end:
1496
1497function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001498version: 9
1499attrib: const
1500w: 2, 3, 4
1501t: f32
1502ret: #2#1
1503arg: #2#1 a
1504arg: #2 b
1505end:
1506
1507function: max
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001508version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001509attrib: const
1510w: 2, 3, 4
1511t: f16
1512ret: #2#1
1513arg: #2#1 a
1514arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001515end:
1516
1517function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001518version: 9 20
1519attrib: const
1520w: 1
1521t: i8, i16, i32, u8, u16, u32
1522ret: #2#1
1523arg: #2#1 a
1524arg: #2#1 b
1525inline:
1526 return (a > b ? a : b);
1527end:
1528
1529function: max
1530version: 9 20
1531attrib: const
1532w: 2
1533t: i8, i16, i32, u8, u16, u32
1534ret: #2#1
1535arg: #2#1 a
1536arg: #2#1 b
1537inline:
1538 #2#1 tmp;
1539 tmp.x = (a.x > b.x ? a.x : b.x);
1540 tmp.y = (a.y > b.y ? a.y : b.y);
1541 return tmp;
1542end:
1543
1544function: max
1545version: 9 20
1546attrib: const
1547w: 3
1548t: i8, i16, i32, u8, u16, u32
1549ret: #2#1
1550arg: #2#1 a
1551arg: #2#1 b
1552inline:
1553 #2#1 tmp;
1554 tmp.x = (a.x > b.x ? a.x : b.x);
1555 tmp.y = (a.y > b.y ? a.y : b.y);
1556 tmp.z = (a.z > b.z ? a.z : b.z);
1557 return tmp;
1558end:
1559
1560function: max
1561version: 9 20
1562attrib: const
1563w: 4
1564t: i8, i16, i32, u8, u16, u32
1565ret: #2#1
1566arg: #2#1 a
1567arg: #2#1 b
1568inline:
1569 #2#1 tmp;
1570 tmp.x = (a.x > b.x ? a.x : b.x);
1571 tmp.y = (a.y > b.y ? a.y : b.y);
1572 tmp.z = (a.z > b.z ? a.z : b.z);
1573 tmp.w = (a.w > b.w ? a.w : b.w);
1574 return tmp;
1575end:
1576
1577function: max
1578version: 21
1579attrib: const
1580w: 1, 2, 3, 4
1581t: i8, i16, i32, i64, u8, u16, u32, u64
1582ret: #2#1
1583arg: #2#1 a
1584arg: #2#1 b
1585end:
1586
1587function: min
1588version: 9
1589attrib: const
1590w: 1, 2, 3, 4
1591t: f32
1592ret: #2#1
1593arg: #2#1 a
1594arg: #2#1 b
1595summary: Minimum
1596description:
1597 Returns the minimum value of two arguments.
1598end:
1599
1600function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001601version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001602attrib: const
1603w: 1, 2, 3, 4
1604t: f16
1605ret: #2#1
1606arg: #2#1 a
1607arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001608end:
1609
1610function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001611version: 9
1612attrib: const
1613w: 2, 3, 4
1614t: f32
1615ret: #2#1
1616arg: #2#1 a
1617arg: #2 b
1618end:
1619
1620function: min
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001621version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001622attrib: const
1623w: 2, 3, 4
1624t: f16
1625ret: #2#1
1626arg: #2#1 a
1627arg: #2 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001628end:
1629
1630function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001631version: 9 20
1632attrib: const
1633w: 1
1634t: i8, i16, i32, u8, u16, u32
1635ret: #2#1
1636arg: #2#1 a
1637arg: #2#1 b
1638inline:
1639 return (a < b ? a : b);
1640end:
1641
1642function: min
1643version: 9 20
1644attrib: const
1645w: 2
1646t: i8, i16, i32, u8, u16, u32
1647ret: #2#1
1648arg: #2#1 a
1649arg: #2#1 b
1650inline:
1651 #2#1 tmp;
1652 tmp.x = (a.x < b.x ? a.x : b.x);
1653 tmp.y = (a.y < b.y ? a.y : b.y);
1654 return tmp;
1655end:
1656
1657function: min
1658version: 9 20
1659attrib: const
1660w: 3
1661t: i8, i16, i32, u8, u16, u32
1662ret: #2#1
1663arg: #2#1 a
1664arg: #2#1 b
1665inline:
1666 #2#1 tmp;
1667 tmp.x = (a.x < b.x ? a.x : b.x);
1668 tmp.y = (a.y < b.y ? a.y : b.y);
1669 tmp.z = (a.z < b.z ? a.z : b.z);
1670 return tmp;
1671end:
1672
1673function: min
1674version: 9 20
1675attrib: const
1676w: 4
1677t: i8, i16, i32, u8, u16, u32
1678ret: #2#1
1679arg: #2#1 a
1680arg: #2#1 b
1681inline:
1682 #2#1 tmp;
1683 tmp.x = (a.x < b.x ? a.x : b.x);
1684 tmp.y = (a.y < b.y ? a.y : b.y);
1685 tmp.z = (a.z < b.z ? a.z : b.z);
1686 tmp.w = (a.w < b.w ? a.w : b.w);
1687 return tmp;
1688end:
1689
1690function: min
1691version: 21
1692attrib: const
1693w: 1, 2, 3, 4
1694t: i8, i16, i32, i64, u8, u16, u32, u64
1695ret: #2#1
1696arg: #2#1 a
1697arg: #2#1 b
1698end:
1699
1700function: mix
1701version: 9
1702attrib: const
1703w: 1, 2, 3, 4
1704t: f32
1705ret: #2#1
1706arg: #2#1 start
1707arg: #2#1 stop
1708arg: #2#1 fraction
1709summary: Mixes two values
1710description:
1711 Returns start + ((stop - start) * fraction).
1712
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001713 This can be useful for mixing two values. For example, to create a new color that is
1714 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001715end:
1716
1717function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001718version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001719attrib: const
1720w: 1, 2, 3, 4
1721t: f16
1722ret: #2#1
1723arg: #2#1 start
1724arg: #2#1 stop
1725arg: #2#1 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001726end:
1727
1728function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001729version: 9
1730attrib: const
1731w: 2, 3, 4
1732t: f32
1733ret: #2#1
1734arg: #2#1 start
1735arg: #2#1 stop
1736arg: #2 fraction
1737end:
1738
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001739function: mix
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001740version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001741attrib: const
1742w: 2, 3, 4
1743t: f16
1744ret: #2#1
1745arg: #2#1 start
1746arg: #2#1 stop
1747arg: #2 fraction
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001748end:
1749
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001750function: modf
1751version: 9
1752w: 1, 2, 3, 4
1753t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001754ret: #2#1, "Floating point portion of the value."
1755arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001756arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1757summary: Integral and fractional components
1758description:
1759 Returns the integral and fractional components of a number.
1760
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001761 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 -08001762 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001763end:
1764
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001765function: modf
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001766version: 24
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001767w: 1, 2, 3, 4
1768t: f16
1769ret: #2#1
1770arg: #2#1 v
1771arg: #2#1* integral_part
1772test: none
1773end:
1774
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001775function: nan
1776version: 9
1777attrib: const
1778w: 1
1779t: f32
1780ret: #2#1
1781arg: uint#1 v, "Not used."
1782#TODO We're not using the argument. Once we do, add this documentation line:
1783# The argument is embedded into the return value and can be used to distinguish various NaNs.
1784summary: Not a Number
1785description:
1786 Returns a NaN value (Not a Number).
1787end:
1788
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001789function: nan_half
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001790version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001791attrib: const
1792t: f16
1793ret: #1
1794summary: Not a Number
1795description:
1796 Returns a half-precision floating point NaN value (Not a Number).
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001797end:
1798
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001799function: native_acos
1800version: 21
1801attrib: const
1802w: 1, 2, 3, 4
1803t: f32
1804ret: #2#1
1805arg: #2#1 v, range(-1,1)
1806summary: Approximate inverse cosine
1807description:
1808 Returns the approximate inverse cosine, in radians.
1809
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001810 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001811
1812 See also @acos().
1813# TODO Temporary
1814test: limited(0.0005)
1815end:
1816
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001817function: native_acos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001818version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001819attrib: const
1820w: 1, 2, 3, 4
1821t: f16
1822ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001823arg: #2#1 v, range(-1,1)
1824# Absolute error of 2^-11, i.e. 0.00048828125
1825test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001826end:
1827
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001828function: native_acosh
1829version: 21
1830attrib: const
1831w: 1, 2, 3, 4
1832t: f32
1833ret: #2#1
1834arg: #2#1 v
1835summary: Approximate inverse hyperbolic cosine
1836description:
1837 Returns the approximate inverse hyperbolic cosine, in radians.
1838
1839 See also @acosh().
1840# TODO Temporary
1841test: limited(0.0005)
1842end:
1843
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001844function: native_acosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001845version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001846attrib: const
1847w: 1, 2, 3, 4
1848t: f16
1849ret: #2#1
1850arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001851end:
1852
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001853function: native_acospi
1854version: 21
1855attrib: const
1856w: 1, 2, 3, 4
1857t: f32
1858ret: #2#1
1859arg: #2#1 v, range(-1,1)
1860summary: Approximate inverse cosine divided by pi
1861description:
1862 Returns the approximate inverse cosine in radians, divided by pi.
1863
1864 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1865
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001866 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001867
1868 See also @acospi().
1869# TODO Temporary
1870test: limited(0.0005)
1871end:
1872
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001873function: native_acospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001874version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001875attrib: const
1876w: 1, 2, 3, 4
1877t: f16
1878ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001879arg: #2#1 v, range(-1,1)
1880# Absolute error of 2^-11, i.e. 0.00048828125
1881test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001882end:
1883
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001884function: native_asin
1885version: 21
1886attrib: const
1887w: 1, 2, 3, 4
1888t: f32
1889ret: #2#1
1890arg: #2#1 v, range(-1,1)
1891summary: Approximate inverse sine
1892description:
1893 Returns the approximate inverse sine, in radians.
1894
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001895 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001896
1897 See also @asin().
1898# TODO Temporary
1899test: limited(0.0005)
1900end:
1901
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001902function: native_asin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001903version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001904attrib: const
1905w: 1, 2, 3, 4
1906t: f16
1907ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001908arg: #2#1 v, range(-1,1)
1909# Absolute error of 2^-11, i.e. 0.00048828125
1910test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001911end:
1912
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001913function: native_asinh
1914version: 21
1915attrib: const
1916w: 1, 2, 3, 4
1917t: f32
1918ret: #2#1
1919arg: #2#1 v
1920summary: Approximate inverse hyperbolic sine
1921description:
1922 Returns the approximate inverse hyperbolic sine, in radians.
1923
1924 See also @asinh().
1925# TODO Temporary
1926test: limited(0.0005)
1927end:
1928
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001929function: native_asinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001930version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001931attrib: const
1932w: 1, 2, 3, 4
1933t: f16
1934ret: #2#1
1935arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001936end:
1937
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001938function: native_asinpi
1939version: 21
1940attrib: const
1941w: 1, 2, 3, 4
1942t: f32
1943ret: #2#1
1944arg: #2#1 v, range(-1,1)
1945summary: Approximate inverse sine divided by pi
1946description:
1947 Returns the approximate inverse sine in radians, divided by pi.
1948
1949 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1950
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001951 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001952
1953 See also @asinpi().
1954# TODO Temporary
1955test: limited(0.0005)
1956end:
1957
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001958function: native_asinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001959version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001960attrib: const
1961w: 1, 2, 3, 4
1962t: f16
1963ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07001964arg: #2#1 v, range(-1,1)
1965# Absolute error of 2^-11, i.e. 0.00048828125
1966test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001967end:
1968
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001969function: native_atan
1970version: 21
1971attrib: const
1972w: 1, 2, 3, 4
1973t: f32
1974ret: #2#1
1975arg: #2#1 v, range(-1,1)
1976summary: Approximate inverse tangent
1977description:
1978 Returns the approximate inverse tangent, in radians.
1979
1980 See also @atan().
1981# TODO Temporary
1982test: limited(0.0005)
1983end:
1984
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001985function: native_atan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08001986version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001987attrib: const
1988w: 1, 2, 3, 4
1989t: f16
1990ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07001991arg: #2#1 v, range(-1, 1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001992end:
1993
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001994function: native_atan2
1995version: 21
1996attrib: const
1997w: 1, 2, 3, 4
1998t: f32
1999ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002000arg: #2#1 numerator, "Numerator."
2001arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002002summary: Approximate inverse tangent of a ratio
2003description:
2004 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
2005
2006 See also @atan2().
2007# TODO Temporary
2008test: limited(0.0005)
2009end:
2010
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002011function: native_atan2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002012version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002013attrib: const
2014w: 1, 2, 3, 4
2015t: f16
2016ret: #2#1
2017arg: #2#1 numerator
2018arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002019end:
2020
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002021function: native_atan2pi
2022version: 21
2023attrib: const
2024w: 1, 2, 3, 4
2025t: f32
2026ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002027arg: #2#1 numerator, "Numerator."
2028arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002029summary: Approximate inverse tangent of a ratio, divided by pi
2030description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002031 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2032 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002033
2034 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2035
2036 See also @atan2pi().
2037# TODO Temporary
2038test: limited(0.0005)
2039end:
2040
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002041function: native_atan2pi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002042version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002043attrib: const
2044w: 1, 2, 3, 4
2045t: f16
2046ret: #2#1
2047arg: #2#1 numerator
2048arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002049end:
2050
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002051function: native_atanh
2052version: 21
2053attrib: const
2054w: 1, 2, 3, 4
2055t: f32
2056ret: #2#1
2057arg: #2#1 v, range(-1,1)
2058summary: Approximate inverse hyperbolic tangent
2059description:
2060 Returns the approximate inverse hyperbolic tangent, in radians.
2061
2062 See also @atanh().
2063# TODO Temporary
2064test: limited(0.0005)
2065end:
2066
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002067function: native_atanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002068version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002069attrib: const
2070w: 1, 2, 3, 4
2071t: f16
2072ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002073arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002074end:
2075
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002076function: native_atanpi
2077version: 21
2078attrib: const
2079w: 1, 2, 3, 4
2080t: f32
2081ret: #2#1
2082arg: #2#1 v, range(-1,1)
2083summary: Approximate inverse tangent divided by pi
2084description:
2085 Returns the approximate inverse tangent in radians, divided by pi.
2086
2087 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2088
2089 See also @atanpi().
2090# TODO Temporary
2091test: limited(0.0005)
2092end:
2093
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002094function: native_atanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002095version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002096attrib: const
2097w: 1, 2, 3, 4
2098t: f16
2099ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002100arg: #2#1 v, range(-1,1)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002101end:
2102
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002103function: native_cbrt
2104version: 21
2105attrib: const
2106w: 1, 2, 3, 4
2107t: f32
2108ret: #2#1
2109arg: #2#1 v
2110summary: Approximate cube root
2111description:
2112 Returns the approximate cubic root.
2113
2114 See also @cbrt().
2115end:
2116
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002117function: native_cbrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002118version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002119attrib: const
2120w: 1, 2, 3, 4
2121t: f16
2122ret: #2#1
2123arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002124end:
2125
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002126function: native_cos
2127version: 21
2128attrib: const
2129w: 1, 2, 3, 4
2130t: f32
2131ret: #2#1
2132arg: #2#1 v
2133summary: Approximate cosine
2134description:
2135 Returns the approximate cosine of an angle measured in radians.
2136
2137 See also @cos().
2138end:
2139
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002140function: native_cos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002141version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002142attrib: const
2143w: 1, 2, 3, 4
2144t: f16
2145ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002146arg: #2#1 v, range(-314,314)
2147# Absolute error of 2^-11, i.e. 0.00048828125
2148test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002149end:
2150
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002151function: native_cosh
2152version: 21
2153attrib: const
2154w: 1, 2, 3, 4
2155t: f32
2156ret: #2#1
2157arg: #2#1 v
2158summary: Approximate hypebolic cosine
2159description:
2160 Returns the approximate hypebolic cosine.
2161
2162 See also @cosh().
2163end:
2164
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002165function: native_cosh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002166version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002167attrib: const
2168w: 1, 2, 3, 4
2169t: f16
2170ret: #2#1
2171arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002172end:
2173
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002174function: native_cospi
2175version: 21
2176attrib: const
2177w: 1, 2, 3, 4
2178t: f32
2179ret: #2#1
2180arg: #2#1 v
2181summary: Approximate cosine of a number multiplied by pi
2182description:
2183 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2184
2185 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2186
2187 See also @cospi().
2188end:
2189
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002190function: native_cospi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002191version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002192attrib: const
2193w: 1, 2, 3, 4
2194t: f16
2195ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002196arg: #2#1 v, range(-100,100)
2197# Absolute error of 2^-11, i.e. 0.00048828125
2198test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002199end:
2200
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002201function: native_divide
2202version: 21
2203attrib: const
2204w: 1, 2, 3, 4
2205t: f32
2206ret: #2#1
2207arg: #2#1 left_vector
2208arg: #2#1 right_vector
2209summary: Approximate division
2210description:
2211 Computes the approximate division of two values.
2212end:
2213
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002214function: native_divide
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002215version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002216attrib: const
2217w: 1, 2, 3, 4
2218t: f16
2219ret: #2#1
2220arg: #2#1 left_vector
2221arg: #2#1 right_vector
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002222end:
2223
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002224function: native_exp
2225version: 18
2226attrib: const
2227w: 1, 2, 3, 4
2228t: f32
2229ret: #2#1
2230arg: #2#1 v, range(-86,86)
2231summary: Approximate e raised to a number
2232description:
2233 Fast approximate exp.
2234
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002235 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2236 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002237
2238 See also @exp().
2239test: limited
2240end:
2241
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002242function: native_exp
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002243version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002244attrib: const
2245w: 1, 2, 3, 4
2246t: f16
2247ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002248arg: #2#1 v, range(-86,86)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002249end:
2250
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002251function: native_exp10
2252version: 18
2253attrib: const
2254w: 1, 2, 3, 4
2255t: f32
2256ret: #2#1
2257arg: #2#1 v, range(-37,37)
2258summary: Approximate 10 raised to a number
2259description:
2260 Fast approximate exp10.
2261
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002262 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2263 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002264
2265 See also @exp10().
2266test: limited
2267end:
2268
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002269function: native_exp10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002270version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002271attrib: const
2272w: 1, 2, 3, 4
2273t: f16
2274ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002275arg: #2#1 v, range(-37,37)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002276end:
2277
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002278function: native_exp2
2279version: 18
2280attrib: const
2281w: 1, 2, 3, 4
2282t: f32
2283ret: #2#1
2284arg: #2#1 v, range(-125,125)
2285summary: Approximate 2 raised to a number
2286description:
2287 Fast approximate exp2.
2288
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002289 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2290 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002291
2292 See also @exp2().
2293test: limited
2294end:
2295
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002296function: native_exp2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002297version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002298attrib: const
2299w: 1, 2, 3, 4
2300t: f16
2301ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002302arg: #2#1 v, range(-125,125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002303end:
2304
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002305function: native_expm1
2306version: 21
2307attrib: const
2308w: 1, 2, 3, 4
2309t: f32
2310ret: #2#1
2311arg: #2#1 v
2312summary: Approximate e raised to a number minus one
2313description:
2314 Returns the approximate (e ^ v) - 1.
2315
2316 See also @expm1().
2317end:
2318
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002319function: native_expm1
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002320version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002321attrib: const
2322w: 1, 2, 3, 4
2323t: f16
2324ret: #2#1
2325arg: #2#1 v
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002326test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002327end:
2328
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002329function: native_hypot
2330version: 21
2331attrib: const
2332w: 1, 2, 3, 4
2333t: f32
2334ret: #2#1
2335arg: #2#1 a
2336arg: #2#1 b
2337summary: Approximate hypotenuse
2338description:
2339 Returns the approximate native_sqrt(a * a + b * b)
2340
2341 See also @hypot().
2342end:
2343
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002344function: native_hypot
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002345version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002346attrib: const
2347w: 1, 2, 3, 4
2348t: f16
2349ret: #2#1
2350arg: #2#1 a
2351arg: #2#1 b
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002352end:
2353
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002354function: native_log
2355version: 18
2356attrib: const
2357w: 1, 2, 3, 4
2358t: f32
2359ret: #2#1
2360arg: #2#1 v, range(10e-10,10e10)
2361summary: Approximate natural logarithm
2362description:
2363 Fast approximate log.
2364
2365 It is not accurate for values very close to zero.
2366
2367 See also @log().
2368test: limited
2369end:
2370
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002371function: native_log
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002372version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002373attrib: const
2374w: 1, 2, 3, 4
2375t: f16
2376ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002377arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002378end:
2379
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002380function: native_log10
2381version: 18
2382attrib: const
2383w: 1, 2, 3, 4
2384t: f32
2385ret: #2#1
2386arg: #2#1 v, range(10e-10,10e10)
2387summary: Approximate base 10 logarithm
2388description:
2389 Fast approximate log10.
2390
2391 It is not accurate for values very close to zero.
2392
2393 See also @log10().
2394test: limited
2395end:
2396
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002397function: native_log10
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002398version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002399attrib: const
2400w: 1, 2, 3, 4
2401t: f16
2402ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002403arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002404end:
2405
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002406function: native_log1p
2407version: 21
2408attrib: const
2409w: 1, 2, 3, 4
2410t: f32
2411ret: #2#1
2412arg: #2#1 v
2413summary: Approximate natural logarithm of a value plus 1
2414description:
2415 Returns the approximate natural logarithm of (v + 1.0f)
2416
2417 See also @log1p().
2418end:
2419
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002420function: native_log1p
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002421version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002422attrib: const
2423w: 1, 2, 3, 4
2424t: f16
2425ret: #2#1
2426arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002427end:
2428
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002429function: native_log2
2430version: 18
2431attrib: const
2432w: 1, 2, 3, 4
2433t: f32
2434ret: #2#1
2435arg: #2#1 v, range(10e-10,10e10)
2436summary: Approximate base 2 logarithm
2437description:
2438 Fast approximate log2.
2439
2440 It is not accurate for values very close to zero.
2441
2442 See also @log2().
2443test: limited
2444end:
2445
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002446function: native_log2
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002447version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002448attrib: const
2449w: 1, 2, 3, 4
2450t: f16
2451ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002452arg: #2#1 v, range(10e-5,65504)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002453end:
2454
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002455function: native_powr
2456version: 18
2457attrib: const
2458w: 1, 2, 3, 4
2459t: f32
2460ret: #2#1
2461arg: #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."
2462arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2463summary: Approximate positive base raised to an exponent
2464description:
2465 Fast approximate (base ^ exponent).
2466
2467 See also @powr().
2468test: limited
2469end:
2470
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002471function: native_powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002472version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002473attrib: const
2474w: 1, 2, 3, 4
2475t: f16
2476ret: #2#1
Pirama Arumuga Nainar5a7cc852016-03-25 15:57:23 -07002477arg: #2#1 base, range(0,256)
2478arg: #2#1 exponent, range(-15,15)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002479end:
2480
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002481function: native_recip
2482version: 21
2483attrib: const
2484w: 1, 2, 3, 4
2485t: f32
2486ret: #2#1
2487arg: #2#1 v
2488summary: Approximate reciprocal
2489description:
2490 Returns the approximate approximate reciprocal of a value.
2491
2492 See also @half_recip().
2493end:
2494
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002495function: native_recip
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002496version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002497attrib: const
2498w: 1, 2, 3, 4
2499t: f16
2500ret: #2#1
2501arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002502end:
2503
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002504function: native_rootn
2505version: 21
2506attrib: const
2507w: 1, 2, 3, 4
2508t: f32
2509ret: #2#1
2510arg: #2#1 v
2511arg: int#1 n
2512summary: Approximate nth root
2513description:
2514 Compute the approximate Nth root of a value.
2515
2516 See also @rootn().
2517end:
2518
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002519function: native_rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002520version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002521attrib: const
2522w: 1, 2, 3, 4
2523t: f16
2524ret: #2#1
2525arg: #2#1 v
2526arg: int#1 n
2527test: none
2528end:
2529
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002530function: native_rsqrt
2531version: 21
2532attrib: const
2533w: 1, 2, 3, 4
2534t: f32
2535ret: #2#1
2536arg: #2#1 v
2537summary: Approximate reciprocal of a square root
2538description:
2539 Returns approximate (1 / sqrt(v)).
2540
2541 See also @rsqrt(), @half_rsqrt().
2542end:
2543
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002544function: native_rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002545version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002546attrib: const
2547w: 1, 2, 3, 4
2548t: f16
2549ret: #2#1
2550arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002551end:
2552
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002553function: native_sin
2554version: 21
2555attrib: const
2556w: 1, 2, 3, 4
2557t: f32
2558ret: #2#1
2559arg: #2#1 v
2560summary: Approximate sine
2561description:
2562 Returns the approximate sine of an angle measured in radians.
2563
2564 See also @sin().
2565end:
2566
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002567function: native_sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002568version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002569attrib: const
2570w: 1, 2, 3, 4
2571t: f16
2572ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002573arg: #2#1 v, range(-314,314)
2574# Absolute error of 2^-11, i.e. 0.00048828125
2575test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002576end:
2577
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002578function: native_sincos
2579version: 21
2580w: 1, 2, 3, 4
2581t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002582ret: #2#1, "Sine."
2583arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002584arg: #2#1* cos, "*cos will be set to the cosine value."
2585summary: Approximate sine and cosine
2586description:
2587 Returns the approximate sine and cosine of a value.
2588
2589 See also @sincos().
2590# TODO Temporary
2591test: limited(0.0005)
2592end:
2593
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002594function: native_sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002595version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002596w: 1, 2, 3, 4
2597t: f16
2598ret: #2#1
2599arg: #2#1 v
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002600arg: #2#1* cos, range(-314,314)
2601# Absolute error of 2^-11, i.e. 0.00048828125
2602test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002603end:
2604
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002605function: native_sinh
2606version: 21
2607attrib: const
2608w: 1, 2, 3, 4
2609t: f32
2610ret: #2#1
2611arg: #2#1 v
2612summary: Approximate hyperbolic sine
2613description:
2614 Returns the approximate hyperbolic sine of a value specified in radians.
2615
2616 See also @sinh().
2617end:
2618
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002619function: native_sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002620version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002621attrib: const
2622w: 1, 2, 3, 4
2623t: f16
2624ret: #2#1
2625arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002626end:
2627
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002628function: native_sinpi
2629version: 21
2630attrib: const
2631w: 1, 2, 3, 4
2632t: f32
2633ret: #2#1
2634arg: #2#1 v
2635summary: Approximate sine of a number multiplied by pi
2636description:
2637 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2638
2639 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2640
2641 See also @sinpi().
2642end:
2643
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002644function: native_sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002645version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002646attrib: const
2647w: 1, 2, 3, 4
2648t: f16
2649ret: #2#1
Pirama Arumuga Nainare47a3062016-03-30 19:00:40 -07002650arg: #2#1 v, range(-100,100)
2651# Absolute error of 2^-11, i.e. 0.00048828125
2652test: limited(0.00048828125)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002653end:
2654
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002655function: native_sqrt
2656version: 21
2657attrib: const
2658w: 1, 2, 3, 4
2659t: f32
2660ret: #2#1
2661arg: #2#1 v
2662summary: Approximate square root
2663description:
2664 Returns the approximate sqrt(v).
2665
2666 See also @sqrt(), @half_sqrt().
2667end:
2668
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002669function: native_sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002670version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002671attrib: const
2672w: 1, 2, 3, 4
2673t: f16
2674ret: #2#1
2675arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002676end:
2677
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002678function: native_tan
2679version: 21
2680attrib: const
2681w: 1, 2, 3, 4
2682t: f32
2683ret: #2#1
2684arg: #2#1 v
2685summary: Approximate tangent
2686description:
2687 Returns the approximate tangent of an angle measured in radians.
2688end:
2689
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002690function: native_tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002691version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002692attrib: const
2693w: 1, 2, 3, 4
2694t: f16
2695ret: #2#1
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002696arg: #2#1 v, range(-314,314)
2697test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002698end:
2699
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002700function: native_tanh
2701version: 21
2702attrib: const
2703w: 1, 2, 3, 4
2704t: f32
2705ret: #2#1
2706arg: #2#1 v
2707summary: Approximate hyperbolic tangent
2708description:
2709 Returns the approximate hyperbolic tangent of a value.
2710
2711 See also @tanh().
2712end:
2713
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002714function: native_tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002715version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002716attrib: const
2717w: 1, 2, 3, 4
2718t: f16
2719ret: #2#1
2720arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002721end:
2722
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002723function: native_tanpi
2724version: 21
2725attrib: const
2726w: 1, 2, 3, 4
2727t: f32
2728ret: #2#1
2729arg: #2#1 v
2730summary: Approximate tangent of a number multiplied by pi
2731description:
2732 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2733
2734 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2735
2736 See also @tanpi().
2737end:
2738
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002739function: native_tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002740version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002741attrib: const
2742w: 1, 2, 3, 4
2743t: f16
2744ret: #2#1
Pirama Arumuga Nainarce671642016-03-31 14:04:48 -07002745arg: #2#1 v, range(-100,100)
2746test: custom
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002747end:
2748
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002749function: nextafter
2750version: 9
2751attrib: const
2752w: 1, 2, 3, 4
2753t: f32
2754ret: #2#1
2755arg: #2#1 v
2756arg: #2#1 target
2757summary: Next floating point number
2758description:
2759 Returns the next representable floating point number from v towards target.
2760
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002761 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2762 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002763end:
2764
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002765function: nextafter
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002766version: 24
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002767attrib: const
2768w: 1, 2, 3, 4
2769t: f16
2770ret: #2#1
2771arg: #2#1 v
2772arg: #2#1 target
2773test: none
2774end:
2775
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002776function: pow
2777version: 9
2778attrib: const
2779w: 1, 2, 3, 4
2780t: f32
2781ret: #2#1
2782arg: #2#1 base
2783arg: #2#1 exponent
2784summary: Base raised to an exponent
2785description:
2786 Returns base raised to the power exponent, i.e. base ^ exponent.
2787
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002788 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2789 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002790end:
2791
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002792function: pow
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002793version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002794attrib: const
2795w: 1, 2, 3, 4
2796t: f16
2797ret: #2#1
2798arg: #2#1 base
2799arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002800end:
2801
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002802function: pown
2803version: 9
2804attrib: const
2805w: 1, 2, 3, 4
2806t: f32
2807ret: #2#1
2808arg: #2#1 base
2809arg: int#1 exponent
2810summary: Base raised to an integer exponent
2811description:
2812 Returns base raised to the power exponent, i.e. base ^ exponent.
2813
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002814 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2815 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002816end:
2817
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002818function: pown
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002819version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002820attrib: const
2821w: 1, 2, 3, 4
2822t: f16
2823ret: #2#1
2824arg: #2#1 base
2825arg: int#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002826end:
2827
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002828function: powr
2829version: 9
2830attrib: const
2831w: 1, 2, 3, 4
2832t: f32
2833ret: #2#1
2834arg: #2#1 base, range(0,3000)
2835arg: #2#1 exponent
2836summary: Positive base raised to an exponent
2837description:
2838 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2839
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002840 @pow() and @pown() are similar. They both make no assumptions about the base.
2841 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002842
2843 See also @native_powr().
2844end:
2845
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002846function: powr
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002847version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002848attrib: const
2849w: 1, 2, 3, 4
2850t: f16
2851ret: #2#1
Pirama Arumuga Nainar55f94822016-03-22 11:55:15 -07002852arg: #2#1 base, range(0,300)
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002853arg: #2#1 exponent
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002854end:
2855
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002856function: radians
2857version: 9
2858attrib: const
2859w: 1, 2, 3, 4
2860t: f32
2861ret: #2#1
2862arg: #2#1 v
2863summary: Converts degrees into radians
2864description:
2865 Converts from degrees to radians.
2866end:
2867
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002868function: radians
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002869version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002870attrib: const
2871w: 1, 2, 3, 4
2872t: f16
2873ret: #2#1
2874arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002875end:
2876
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002877function: remainder
2878version: 9
2879attrib: const
2880w: 1, 2, 3, 4
2881t: f32
2882ret: #2#1
2883arg: #2#1 numerator
2884arg: #2#1 denominator
2885summary: Remainder of a division
2886description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002887 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2888 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002889
2890 The function @fmod() is similar but rounds toward the closest interger.
2891 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2892 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2893end:
2894
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002895function: remainder
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002896version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002897attrib: const
2898w: 1, 2, 3, 4
2899t: f16
2900ret: #2#1
2901arg: #2#1 numerator
2902arg: #2#1 denominator
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002903end:
2904
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002905function: remquo
2906version: 9
2907w: 1, 2, 3, 4
2908t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002909ret: #2#1, "Remainder, precise only for the low three bits."
2910arg: #2#1 numerator, "Numerator."
2911arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002912arg: int#1* quotient, "*quotient will be set to the integer quotient."
2913summary: Remainder and quotient of a division
2914description:
2915 Returns the quotient and the remainder of (numerator / denominator).
2916
2917 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2918
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002919 This function is useful for implementing periodic functions. The low three bits of the
2920 quotient gives the quadrant and the remainder the distance within the quadrant.
2921 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2922 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002923
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002924 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2925 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002926test: custom
2927end:
2928
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002929function: remquo
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002930version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002931w: 1, 2, 3, 4
2932t: f16
2933ret: #2#1
2934arg: #2#1 numerator
2935arg: #2#1 denominator
2936arg: int#1* quotient
2937test: none
2938end:
2939
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002940function: rint
2941version: 9
2942attrib: const
2943w: 1, 2, 3, 4
2944t: f32
2945ret: #2#1
2946arg: #2#1 v
2947summary: Round to even
2948description:
2949 Rounds to the nearest integral value.
2950
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002951 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2952 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2953 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002954
2955 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2956end:
2957
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002958function: rint
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002959version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002960attrib: const
2961w: 1, 2, 3, 4
2962t: f16
2963ret: #2#1
2964arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002965end:
2966
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002967function: rootn
2968version: 9
2969attrib: const
2970w: 1, 2, 3, 4
2971t: f32
2972ret: #2#1
2973arg: #2#1 v
2974arg: int#1 n
2975summary: Nth root
2976description:
2977 Compute the Nth root of a value.
2978
2979 See also @native_rootn().
2980end:
2981
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002982function: rootn
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08002983version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002984attrib: const
2985w: 1, 2, 3, 4
2986t: f16
2987ret: #2#1
2988arg: #2#1 v
2989arg: int#1 n
2990test: none
2991end:
2992
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002993function: round
2994version: 9
2995attrib: const
2996w: 1, 2, 3, 4
2997t: f32
2998ret: #2#1
2999arg: #2#1 v
3000summary: Round away from zero
3001description:
3002 Round to the nearest integral value.
3003
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003004 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
3005 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
3006 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003007
3008 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
3009end:
3010
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003011function: round
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003012version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003013attrib: const
3014w: 1, 2, 3, 4
3015t: f16
3016ret: #2#1
3017arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003018end:
3019
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003020function: rsqrt
3021version: 9
3022attrib: const
3023w: 1, 2, 3, 4
3024t: f32
3025ret: #2#1
3026arg: #2#1 v
3027summary: Reciprocal of a square root
3028description:
3029 Returns (1 / sqrt(v)).
3030
3031 See also @half_rsqrt(), @native_rsqrt().
3032end:
3033
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003034function: rsqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003035version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003036attrib: const
3037w: 1, 2, 3, 4
3038t: f16
3039ret: #2#1
3040arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003041end:
3042
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003043function: sign
3044version: 9
3045attrib: const
3046w: 1, 2, 3, 4
3047t: f32
3048ret: #2#1
3049arg: #2#1 v
3050summary: Sign of a value
3051description:
3052 Returns the sign of a value.
3053
3054 if (v &lt; 0) return -1.f;
3055 else if (v &gt; 0) return 1.f;
3056 else return 0.f;
3057end:
3058
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003059function: sign
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003060version:24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003061attrib: const
3062w: 1, 2, 3, 4
3063t: f16
3064ret: #2#1
3065arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003066end:
3067
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003068function: sin
3069version: 9
3070attrib: const
3071w: 1, 2, 3, 4
3072t: f32
3073ret: #2#1
3074arg: #2#1 v
3075summary: Sine
3076description:
3077 Returns the sine of an angle measured in radians.
3078
3079 See also @native_sin().
3080end:
3081
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003082function: sin
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003083version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003084attrib: const
3085w: 1, 2, 3, 4
3086t: f16
3087ret: #2#1
3088arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003089end:
3090
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003091function: sincos
3092version: 9
3093w: 1, 2, 3, 4
3094t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003095ret: #2#1, "Sine of v."
3096arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003097arg: #2#1* cos, "*cos will be set to the cosine value."
3098summary: Sine and cosine
3099description:
3100 Returns the sine and cosine of a value.
3101
3102 See also @native_sincos().
3103end:
3104
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003105function: sincos
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003106version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003107w: 1, 2, 3, 4
3108t: f16
3109ret: #2#1
3110arg: #2#1 v
3111arg: #2#1* cos
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003112end:
3113
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003114function: sinh
3115version: 9
3116attrib: const
3117w: 1, 2, 3, 4
3118t: f32
3119ret: #2#1
3120arg: #2#1 v
3121summary: Hyperbolic sine
3122description:
3123 Returns the hyperbolic sine of v, where v is measured in radians.
3124
3125 See also @native_sinh().
3126end:
3127
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003128function: sinh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003129version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003130attrib: const
3131w: 1, 2, 3, 4
3132t: f16
3133ret: #2#1
3134arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003135end:
3136
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003137function: sinpi
3138version: 9
3139attrib: const
3140w: 1, 2, 3, 4
3141t: f32
3142ret: #2#1
3143arg: #2#1 v
3144summary: Sine of a number multiplied by pi
3145description:
3146 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3147
3148 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3149
3150 See also @native_sinpi().
3151end:
3152
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003153function: sinpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003154version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003155attrib: const
3156w: 1, 2, 3, 4
3157t: f16
3158ret: #2#1
3159arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003160end:
3161
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003162function: sqrt
3163version: 9
3164attrib: const
3165w: 1, 2, 3, 4
3166t: f32
3167ret: #2#1
3168arg: #2#1 v
3169summary: Square root
3170description:
3171 Returns the square root of a value.
3172
3173 See also @half_sqrt(), @native_sqrt().
3174end:
3175
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003176function: sqrt
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003177version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003178attrib: const
3179w: 1, 2, 3, 4
3180t: f16
3181ret: #2#1
3182arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003183end:
3184
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003185function: step
3186version: 9
3187attrib: const
3188w: 1, 2, 3, 4
3189t: f32
3190ret: #2#1
3191arg: #2#1 edge
3192arg: #2#1 v
3193summary: 0 if less than a value, 0 otherwise
3194description:
3195 Returns 0.f if v &lt; edge, 1.f otherwise.
3196
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003197 This can be useful to create conditional computations without using loops and branching
3198 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3199 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 -07003200end:
3201
3202function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003203version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003204attrib: const
3205w: 1, 2, 3, 4
3206t: f16
3207ret: #2#1
3208arg: #2#1 edge
3209arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003210end:
3211
3212function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003213version: 9
3214attrib: const
3215w: 2, 3, 4
3216t: f32
3217ret: #2#1
3218arg: #2#1 edge
3219arg: #2 v
3220end:
3221
3222function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003223version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003224attrib: const
3225w: 2, 3, 4
3226t: f16
3227ret: #2#1
3228arg: #2#1 edge
3229arg: #2 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003230end:
3231
3232function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003233version: 21
3234attrib: const
3235w: 2, 3, 4
3236t: f32
3237ret: #2#1
3238arg: #2 edge
3239arg: #2#1 v
3240end:
3241
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003242function: step
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003243version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003244attrib: const
3245w: 2, 3, 4
3246t: f16
3247ret: #2#1
3248arg: #2 edge
3249arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003250end:
3251
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003252function: tan
3253version: 9
3254attrib: const
3255w: 1, 2, 3, 4
3256t: f32
3257ret: #2#1
3258arg: #2#1 v
3259summary: Tangent
3260description:
3261 Returns the tangent of an angle measured in radians.
3262
3263 See also @native_tan().
3264end:
3265
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003266function: tan
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003267version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003268attrib: const
3269w: 1, 2, 3, 4
3270t: f16
3271ret: #2#1
3272arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003273end:
3274
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003275function: tanh
3276version: 9
3277attrib: const
3278w: 1, 2, 3, 4
3279t: f32
3280ret: #2#1
3281arg: #2#1 v
3282summary: Hyperbolic tangent
3283description:
3284 Returns the hyperbolic tangent of a value.
3285
3286 See also @native_tanh().
3287end:
3288
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003289function: tanh
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003290version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003291attrib: const
3292w: 1, 2, 3, 4
3293t: f16
3294ret: #2#1
3295arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003296end:
3297
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003298function: tanpi
3299version: 9
3300attrib: const
3301w: 1, 2, 3, 4
3302t: f32
3303ret: #2#1
3304arg: #2#1 v
3305summary: Tangent of a number multiplied by pi
3306description:
3307 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3308
3309 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3310
3311 See also @native_tanpi().
3312end:
3313
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003314function: tanpi
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003315version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003316attrib: const
3317w: 1, 2, 3, 4
3318t: f16
3319ret: #2#1
3320arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003321end:
3322
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003323function: tgamma
3324version: 9
3325attrib: const
3326w: 1, 2, 3, 4
3327t: f32
3328ret: #2#1
3329arg: #2#1 v
3330summary: Gamma function
3331description:
3332 Returns the gamma function of a value.
3333
3334 See also @lgamma().
3335end:
3336
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003337function: tgamma
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003338version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003339attrib: const
3340w: 1, 2, 3, 4
3341t: f16
3342ret: #2#1
3343arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003344end:
3345
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003346function: trunc
3347version: 9
3348attrib: const
3349w: 1, 2, 3, 4
3350t: f32
3351ret: #2#1
3352arg: #2#1 v
3353summary: Truncates a floating point
3354description:
3355 Rounds to integral using truncation.
3356
3357 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3358
3359 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003360end:
3361
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003362function: trunc
Pirama Arumuga Nainar132b31f2016-02-18 14:46:28 -08003363version: 24
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003364attrib: const
3365w: 1, 2, 3, 4
3366t: f16
3367ret: #2#1
3368arg: #2#1 v
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003369end:
3370
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003371function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003372attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003373t: i8, i16, i32, u8, u16, u32
3374ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003375arg: #1 amount, "Value to clamp."
3376arg: #1 low, "Lower bound."
3377arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003378deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003379summary: Restrain a value to a range
3380description:
3381 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003382test: none
3383end:
3384
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003385function: rsFrac
3386attrib: const
3387ret: float
3388arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003389deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003390summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003391description:
3392 Returns the fractional part of a float
3393test: none
3394end:
3395
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003396function: rsRand
3397ret: int
3398arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003399summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003400description:
3401 Return a random value between 0 (or min_value) and max_malue.
3402test: none
3403end:
3404
3405function: rsRand
3406ret: int
3407arg: int min_value
3408arg: int max_value
3409test: none
3410end:
3411
3412function: rsRand
3413ret: float
3414arg: float max_value
3415test: none
3416end:
3417
3418function: rsRand
3419ret: float
3420arg: float min_value
3421arg: float max_value
3422test: none
3423end: