blob: b70e2102b3077c6f5d1110d4d46902d71959ffd1 [file] [log] [blame]
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07001#
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002# Copyright (C) 2014 The Android Open Source Project
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17header:
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070018summary: Mathematical Constants and Functions
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -070019description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070020 The mathematical functions below can be applied to scalars and vectors. When applied
21 to vectors, the returned value is a vector of the function applied to each entry of the input.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070022
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070023 For example:<code><br/>
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070024 float3 a, b;<br/>
25 // The following call sets<br/>
26 // a.x to sin(b.x),<br/>
27 // a.y to sin(b.y), and<br/>
28 // a.z to sin(b.z).<br/>
29 a = sin(b);<br/>
30 </code>
31
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070032 See <a href='rs_vector_math.html'>Vector Math Functions</a> for functions like @distance() and @length() that interpret
33 instead the input as a single vector in n-dimensional space.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070034
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070035 The precision of the mathematical operations on 32 bit floats is affected by the pragmas
36 rs_fp_relaxed and rs_fp_full. Under rs_fp_relaxed, subnormal values may be flushed to zero and
37 rounding may be done towards zero. In comparison, rs_fp_full requires correct handling of
38 subnormal values, i.e. smaller than 1.17549435e-38f. rs_fp_rull also requires round to nearest
39 with ties to even.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070040
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -070041 Different precision/speed tradeoffs can be achieved by using variants of the common math
42 functions. Functions with a name starting with<ul>
43 <li>native_: May have custom hardware implementations with weaker precision. Additionally,
44 subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
45 infinity input may not be handled correctly.</li>
46 <li>half_: May perform internal computations using 16 bit floats. Additionally, subnormal
47 values may be flushed to zero, and rounding towards zero may be used.</li>
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070048 </ul>
49end:
50
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -080051# TODO Add f16 versions of these constants.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070052constant: M_1_PI
53value: 0.318309886183790671537767526745028724f
54summary: 1 / pi, as a 32 bit float
55description:
56 The inverse of pi, as a 32 bit float.
57end:
58
59constant: M_2_PI
60value: 0.636619772367581343075535053490057448f
61summary: 2 / pi, as a 32 bit float
62description:
63 2 divided by pi, as a 32 bit float.
64end:
65
66constant: M_2_PIl
67value: 0.636619772367581343075535053490057448f
68hidden:
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -070069deprecated: 22, Use M_2_PI instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070070summary: 2 / pi, as a 32 bit float
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070071description:
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -070072 2 divided by pi, as a 32 bit float.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -070073end:
74
75constant: M_2_SQRTPI
76value: 1.128379167095512573896158903121545172f
77summary: 2 / sqrt(pi), as a 32 bit float
78description:
79 2 divided by the square root of pi, as a 32 bit float.
80end:
81
82constant: M_E
83value: 2.718281828459045235360287471352662498f
84summary: e, as a 32 bit float
85description:
86 The number e, the base of the natural logarithm, as a 32 bit float.
87end:
88
89constant: M_LN10
90value: 2.302585092994045684017991454684364208f
91summary: log_e(10), as a 32 bit float
92description:
93 The natural logarithm of 10, as a 32 bit float.
94end:
95
96constant: M_LN2
97value: 0.693147180559945309417232121458176568f
98summary: log_e(2), as a 32 bit float
99description:
100 The natural logarithm of 2, as a 32 bit float.
101end:
102
103constant: M_LOG10E
104value: 0.434294481903251827651128918916605082f
105summary: log_10(e), as a 32 bit float
106description:
107 The logarithm base 10 of e, as a 32 bit float.
108end:
109
110constant: M_LOG2E
111value: 1.442695040888963407359924681001892137f
112summary: log_2(e), as a 32 bit float
113description:
114 The logarithm base 2 of e, as a 32 bit float.
115end:
116
117constant: M_PI
118value: 3.141592653589793238462643383279502884f
119summary: pi, as a 32 bit float
120description:
121 The constant pi, as a 32 bit float.
122end:
123
124constant: M_PI_2
125value: 1.570796326794896619231321691639751442f
126summary: pi / 2, as a 32 bit float
127description:
128 Pi divided by 2, as a 32 bit float.
129end:
130
131constant: M_PI_4
132value: 0.785398163397448309615660845819875721f
133summary: pi / 4, as a 32 bit float
134description:
135 Pi divided by 4, as a 32 bit float.
136end:
137
138constant: M_SQRT1_2
139value: 0.707106781186547524400844362104849039f
140summary: 1 / sqrt(2), as a 32 bit float
141description:
142 The inverse of the square root of 2, as a 32 bit float.
143end:
144
145constant: M_SQRT2
146value: 1.414213562373095048801688724209698079f
147summary: sqrt(2), as a 32 bit float
148description:
149 The square root of 2, as a 32 bit float.
150end:
151
152function: abs
153version: 9
154attrib: const
155w: 1, 2, 3, 4
156t: i8, i16, i32
157ret: u#2#1
158arg: #2#1 v
159summary: Absolute value of an integer
160description:
161 Returns the absolute value of an integer.
162
163 For floats, use @fabs().
164end:
165
166function: acos
167version: 9
168attrib: const
169w: 1, 2, 3, 4
170t: f32
171ret: #2#1
172arg: #2#1 v, range(-1,1)
173summary: Inverse cosine
174description:
175 Returns the inverse cosine, in radians.
176
177 See also @native_acos().
178end:
179
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800180function: acos
181version: UNRELEASED
182attrib: const
183w: 1, 2, 3, 4
184t: f16
185ret: #2#1
186arg: #2#1 v
187test: none
188end:
189
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700190function: acosh
191version: 9
192attrib: const
193w: 1, 2, 3, 4
194t: f32
195ret: #2#1
196arg: #2#1 v
197summary: Inverse hyperbolic cosine
198description:
199 Returns the inverse hyperbolic cosine, in radians.
200
201 See also @native_acosh().
202end:
203
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800204function: acosh
205version: UNRELEASED
206attrib: const
207w: 1, 2, 3, 4
208t: f16
209ret: #2#1
210arg: #2#1 v
211test: none
212end:
213
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700214function: acospi
215version: 9
216attrib: const
217w: 1, 2, 3, 4
218t: f32
219ret: #2#1
220arg: #2#1 v, range(-1,1)
221summary: Inverse cosine divided by pi
222description:
223 Returns the inverse cosine in radians, divided by pi.
224
225 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
226
227 See also @native_acospi().
228end:
229
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800230function: acospi
231version: UNRELEASED
232attrib: const
233w: 1, 2, 3, 4
234t: f16
235ret: #2#1
236arg: #2#1 v
237test: none
238end:
239
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700240function: asin
241version: 9
242attrib: const
243w: 1, 2, 3, 4
244t: f32
245ret: #2#1
246arg: #2#1 v, range(-1,1)
247summary: Inverse sine
248description:
249 Returns the inverse sine, in radians.
250
251 See also @native_asin().
252end:
253
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800254function: asin
255version: UNRELEASED
256attrib: const
257w: 1, 2, 3, 4
258t: f16
259ret: #2#1
260arg: #2#1 v
261test: none
262end:
263
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700264function: asinh
265version: 9
266attrib: const
267w: 1, 2, 3, 4
268t: f32
269ret: #2#1
270arg: #2#1 v
271summary: Inverse hyperbolic sine
272description:
273 Returns the inverse hyperbolic sine, in radians.
274
275 See also @native_asinh().
276end:
277
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800278function: asinh
279version: UNRELEASED
280attrib: const
281w: 1, 2, 3, 4
282t: f16
283ret: #2#1
284arg: #2#1 v
285test: none
286end:
287
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700288function: asinpi
289version: 9
290attrib: const
291w: 1, 2, 3, 4
292t: f32
293ret: #2#1
294arg: #2#1 v, range(-1,1)
295summary: Inverse sine divided by pi
296description:
297 Returns the inverse sine in radians, divided by pi.
298
299 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
300
301 See also @native_asinpi().
302end:
303
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800304function: asinpi
305version: UNRELEASED
306attrib: const
307w: 1, 2, 3, 4
308t: f16
309ret: #2#1
310arg: #2#1 v
311test: none
312end:
313
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700314function: atan
315version: 9
316attrib: const
317w: 1, 2, 3, 4
318t: f32
319ret: #2#1
320arg: #2#1 v, range(-1,1)
321summary: Inverse tangent
322description:
323 Returns the inverse tangent, in radians.
324
325 See also @native_atan().
326end:
327
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800328function: atan
329version: UNRELEASED
330attrib: const
331w: 1, 2, 3, 4
332t: f16
333ret: #2#1
334arg: #2#1 v
335test: none
336end:
337
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700338function: atan2
339version: 9
340attrib: const
341w: 1, 2, 3, 4
342t: f32
343ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700344arg: #2#1 numerator, "Numerator."
345arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700346summary: Inverse tangent of a ratio
347description:
348 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians.
349
350 See also @native_atan2().
351end:
352
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800353function: atan2
354version: UNRELEASED
355attrib: const
356w: 1, 2, 3, 4
357t: f16
358ret: #2#1
359arg: #2#1 numerator
360arg: #2#1 denominator
361test: none
362end:
363
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700364function: atan2pi
365version: 9
366attrib: const
367w: 1, 2, 3, 4
368t: f32
369ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700370arg: #2#1 numerator, "Numerator."
371arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700372summary: Inverse tangent of a ratio, divided by pi
373description:
374 Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians, divided by pi.
375
376 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
377
378 See also @native_atan2pi().
379end:
380
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800381function: atan2pi
382version: UNRELEASED
383attrib: const
384w: 1, 2, 3, 4
385t: f16
386ret: #2#1
387arg: #2#1 numerator
388arg: #2#1 denominator
389test: none
390end:
391
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700392function: atanh
393version: 9
394attrib: const
395w: 1, 2, 3, 4
396t: f32
397ret: #2#1
398arg: #2#1 v, range(-1,1)
399summary: Inverse hyperbolic tangent
400description:
401 Returns the inverse hyperbolic tangent, in radians.
402
403 See also @native_atanh().
404end:
405
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800406function: atanh
407version: UNRELEASED
408attrib: const
409w: 1, 2, 3, 4
410t: f16
411ret: #2#1
412arg: #2#1 v
413test: none
414end:
415
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700416function: atanpi
417version: 9
418attrib: const
419w: 1, 2, 3, 4
420t: f32
421ret: #2#1
422arg: #2#1 v, range(-1,1)
423summary: Inverse tangent divided by pi
424description:
425 Returns the inverse tangent in radians, divided by pi.
426
427 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
428
429 See also @native_atanpi().
430end:
431
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800432function: atanpi
433version: UNRELEASED
434attrib: const
435w: 1, 2, 3, 4
436t: f16
437ret: #2#1
438arg: #2#1 v
439test: none
440end:
441
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700442function: cbrt
443version: 9
444attrib: const
445w: 1, 2, 3, 4
446t: f32
447ret: #2#1
448arg: #2#1 v
449summary: Cube root
450description:
451 Returns the cube root.
452
453 See also @native_cbrt().
454end:
455
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800456function: cbrt
457version: UNRELEASED
458attrib: const
459w: 1, 2, 3, 4
460t: f16
461ret: #2#1
462arg: #2#1 v
463test: none
464end:
465
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700466function: ceil
467version: 9
468attrib: const
469w: 1, 2, 3, 4
470t: f32
471ret: #2#1
472arg: #2#1 v
473summary: Smallest integer not less than a value
474description:
475 Returns the smallest integer not less than a value.
476
477 For example, <code>ceil(1.2f)</code> returns 2.f, and <code>ceil(-1.2f)</code> returns -1.f.
478
479 See also @floor().
480end:
481
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800482function: ceil
483version: UNRELEASED
484attrib: const
485w: 1, 2, 3, 4
486t: f16
487ret: #2#1
488arg: #2#1 v
489test: none
490end:
491
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700492function: clamp
493version: 9
494attrib: const
495w: 1, 2, 3, 4
496t: f32
497ret: #2#1
498arg: #2#1 value, "Value to be clamped."
499arg: #2#1 min_value, "Lower bound, a scalar or matching vector."
500arg: #2#1 max_value, above(min_value), "High bound, must match the type of low."
501summary: Restrain a value to a range
502description:
503 Clamps a value to a specified high and low bound. clamp() returns min_value
504 if value &lt; min_value, max_value if value &gt; max_value, otherwise value.
505
506 There are two variants of clamp: one where the min and max are scalars applied
507 to all entries of the value, the other where the min and max are also vectors.
508
509 If min_value is greater than max_value, the results are undefined.
510end:
511
512function: clamp
513version: 9
514attrib: const
515w: 2, 3, 4
516t: f32
517ret: #2#1
518arg: #2#1 value
519arg: #2 min_value
520arg: #2 max_value, above(min_value)
521end:
522
523function: clamp
524version: 19
525attrib: const
526w: 1, 2, 3, 4
527t: u8, u16, u32, u64, i8, i16, i32, i64
528ret: #2#1
529arg: #2#1 value
530arg: #2#1 min_value
531arg: #2#1 max_value, above(min_value)
532end:
533
534function: clamp
535version: 19
536attrib: const
537w: 2, 3, 4
538t: u8, u16, u32, u64, i8, i16, i32, i64
539ret: #2#1
540arg: #2#1 value
541arg: #2 min_value
542arg: #2 max_value, above(min_value)
543end:
544
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800545function: clamp
546version: UNRELEASED
547attrib: const
548w: 1, 2, 3, 4
549t: f16
550ret: #2#1
551arg: #2#1 value
552arg: #2#1 min_value
553arg: #2#1 max_value, above(min_value)
554test: none
555end:
556
557function: clamp
558version: UNRELEASED
559attrib: 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)
566test: none
567end:
568
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700569function: clz
570version: 9
571attrib: const
572w: 1, 2, 3, 4
573t: u8, u16, u32, i8, i16, i32
574ret: #2#1
575arg: #2#1 value
576summary: Number of leading 0 bits
577description:
578 Returns the number of leading 0-bits in a value.
579
580 For example, <code>clz((char)0x03)</code> returns 6.
581end:
582
583function: copysign
584version: 9
585attrib: const
586w: 1, 2, 3, 4
587t: f32
588ret: #2#1
589arg: #2#1 magnitude_value
590arg: #2#1 sign_value
591summary: Copies the sign of a number to another
592description:
593 Copies the sign from sign_value to magnitude_value.
594
595 The value returned is either magnitude_value or -magnitude_value.
596
597 For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
598end:
599
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -0800600function: copysign
601version: UNRELEASED
602attrib: const
603w: 1, 2, 3, 4
604t: f16
605ret: #2#1
606arg: #2#1 magnitude_value
607arg: #2#1 sign_value
608test: none
609end:
610
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700611function: cos
612version: 9
613attrib: const
614w: 1, 2, 3, 4
615t: f32
616ret: #2#1
617arg: #2#1 v
618summary: Cosine
619description:
620 Returns the cosine of an angle measured in radians.
621
622 See also @native_cos().
623end:
624
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800625function: cos
626version: UNRELEASED
627attrib: const
628w: 1, 2, 3, 4
629t: f16
630ret: #2#1
631arg: #2#1 v
632test: none
633end:
634
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700635function: cosh
636version: 9
637attrib: const
638w: 1, 2, 3, 4
639t: f32
640ret: #2#1
641arg: #2#1 v
642summary: Hypebolic cosine
643description:
644 Returns the hypebolic cosine of v, where v is measured in radians.
645
646 See also @native_cosh().
647end:
648
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800649function: cosh
650version: UNRELEASED
651attrib: const
652w: 1, 2, 3, 4
653t: f16
654ret: #2#1
655arg: #2#1 v
656test: none
657end:
658
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700659function: cospi
660version: 9
661attrib: const
662w: 1, 2, 3, 4
663t: f32
664ret: #2#1
665arg: #2#1 v
666summary: Cosine of a number multiplied by pi
667description:
668 Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
669
670 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
671
672 See also @native_cospi().
673end:
674
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800675function: cospi
676version: UNRELEASED
677attrib: const
678w: 1, 2, 3, 4
679t: f16
680ret: #2#1
681arg: #2#1 v
682test: none
683end:
684
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700685function: degrees
686version: 9
687attrib: const
688w: 1, 2, 3, 4
689t: f32
690ret: #2#1
691arg: #2#1 v
692summary: Converts radians into degrees
693description:
694 Converts from radians to degrees.
695end:
696
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800697function: degrees
698version: UNRELEASED
699attrib: const
700w: 1, 2, 3, 4
701t: f16
702ret: #2#1
703arg: #2#1 v
704test: none
705end:
706
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700707function: erf
708version: 9
709attrib: const
710w: 1, 2, 3, 4
711t: f32
712ret: #2#1
713arg: #2#1 v
714summary: Mathematical error function
715description:
716 Returns the error function.
717end:
718
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800719function: erf
720version: UNRELEASED
721attrib: const
722w: 1, 2, 3, 4
723t: f16
724ret: #2#1
725arg: #2#1 v
726test: none
727end:
728
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700729function: erfc
730version: 9
731attrib: const
732w: 1, 2, 3, 4
733t: f32
734ret: #2#1
735arg: #2#1 v
736summary: Mathematical complementary error function
737description:
738 Returns the complementary error function.
739end:
740
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800741function: erfc
742version: UNRELEASED
743attrib: const
744w: 1, 2, 3, 4
745t: f16
746ret: #2#1
747arg: #2#1 v
748test: none
749end:
750
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700751function: exp
752version: 9
753attrib: const
754w: 1, 2, 3, 4
755t: f32
756ret: #2#1
757arg: #2#1 v
758summary: e raised to a number
759description:
760 Returns e raised to v, i.e. e ^ v.
761
762 See also @native_exp().
763end:
764
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800765function: exp
766version: UNRELEASED
767attrib: const
768w: 1, 2, 3, 4
769t: f16
770ret: #2#1
771arg: #2#1 v
772test: none
773end:
774
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700775function: exp10
776version: 9
777attrib: const
778w: 1, 2, 3, 4
779t: f32
780ret: #2#1
781arg: #2#1 v
782summary: 10 raised to a number
783description:
784 Returns 10 raised to v, i.e. 10.f ^ v.
785
786 See also @native_exp10().
787end:
788
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800789function: exp10
790version: UNRELEASED
791attrib: const
792w: 1, 2, 3, 4
793t: f16
794ret: #2#1
795arg: #2#1 v
796test: none
797end:
798
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700799function: exp2
800version: 9
801attrib: const
802w: 1, 2, 3, 4
803t: f32
804ret: #2#1
805arg: #2#1 v
806summary: 2 raised to a number
807description:
808 Returns 2 raised to v, i.e. 2.f ^ v.
809
810 See also @native_exp2().
811end:
812
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800813function: exp2
814version: UNRELEASED
815attrib: const
816w: 1, 2, 3, 4
817t: f16
818ret: #2#1
819arg: #2#1 v
820test: none
821end:
822
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700823function: expm1
824version: 9
825attrib: const
826w: 1, 2, 3, 4
827t: f32
828ret: #2#1
829arg: #2#1 v
830summary: e raised to a number minus one
831description:
832 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
833
834 See also @native_expm1().
835end:
836
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800837function: expm1
838version: UNRELEASED
839attrib: const
840w: 1, 2, 3, 4
841t: f16
842ret: #2#1
843arg: #2#1 v
844test: none
845end:
846
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700847function: fabs
848version: 9
849attrib: const
850w: 1, 2, 3, 4
851t: f32
852ret: #2#1
853arg: #2#1 v
854summary: Absolute value of a float
855description:
856 Returns the absolute value of the float v.
857
858 For integers, use @abs().
859end:
860
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800861function: fabs
862version: UNRELEASED
863attrib: const
864w: 1, 2, 3, 4
865t: f16
866ret: #2#1
867arg: #2#1 v
868test: none
869end:
870
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700871function: fdim
872version: 9
873attrib: const
874w: 1, 2, 3, 4
875t: f32
876ret: #2#1
877arg: #2#1 a
878arg: #2#1 b
879summary: Positive difference between two values
880description:
881 Returns the positive difference between two values.
882
883 If a &gt; b, returns (a - b) otherwise returns 0f.
884end:
885
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800886function: fdim
887version: UNRELEASED
888attrib: const
889w: 1, 2, 3, 4
890t: f16
891ret: #2#1
892arg: #2#1 a
893arg: #2#1 b
894test: none
895end:
896
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700897function: floor
898version: 9
899attrib: const
900w: 1, 2, 3, 4
901t: f32
902ret: #2#1
903arg: #2#1 v
904summary: Smallest integer not greater than a value
905description:
906 Returns the smallest integer not greater than a value.
907
908 For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
909
910 See also @ceil().
911end:
912
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800913function: floor
914version: UNRELEASED
915attrib: const
916w: 1, 2, 3, 4
917t: f16
918ret: #2#1
919arg: #2#1 v
920test: none
921end:
922
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700923function: fma
924version: 9
925attrib: const
926w: 1, 2, 3, 4
927t: f32
928ret: #2#1
929arg: #2#1 multiplicand1
930arg: #2#1 multiplicand2
931arg: #2#1 offset
932summary: Multiply and add
933description:
934 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
935
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700936 This function is similar to @mad(). fma() retains full precision of the multiplied result
937 and rounds only after the addition. @mad() rounds after the multiplication and the addition.
938 This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700939end:
940
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800941function: fma
942version: UNRELEASED
943attrib: const
944w: 1, 2, 3, 4
945t: f16
946ret: #2#1
947arg: #2#1 multiplicand1
948arg: #2#1 multiplicand2
949arg: #2#1 offset
950test: none
951end:
952
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700953function: fmax
954version: 9
955attrib: const
956w: 1, 2, 3, 4
957t: f32
958ret: #2#1
959arg: #2#1 a
960arg: #2#1 b
961summary: Maximum of two floats
962description:
963 Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
964
965 The @max() function returns identical results but can be applied to more data types.
966end:
967
968function: fmax
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800969version: UNRELEASED
970attrib: const
971w: 1, 2, 3, 4
972t: f16
973ret: #2#1
974arg: #2#1 a
975arg: #2#1 b
976test: none
977end:
978
979function: fmax
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700980version: 9
981attrib: const
982w: 2, 3, 4
983t: f32
984ret: #2#1
985arg: #2#1 a
986arg: #2 b
987end:
988
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800989function: fmax
990version: UNRELEASED
991attrib: const
992w: 2, 3, 4
993t: f16
994ret: #2#1
995arg: #2#1 a
996arg: #2 b
997test: none
998end:
999
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001000function: fmin
1001version: 9
1002attrib: const
1003w: 1, 2, 3, 4
1004t: f32
1005ret: #2#1
1006arg: #2#1 a
1007arg: #2#1 b
1008summary: Minimum of two floats
1009description:
1010 Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
1011
1012 The @min() function returns identical results but can be applied to more data types.
1013end:
1014
1015function: fmin
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001016version: UNRELEASED
1017attrib: const
1018w: 1, 2, 3, 4
1019t: f16
1020ret: #2#1
1021arg: #2#1 a
1022arg: #2#1 b
1023test: none
1024end:
1025
1026function: fmin
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001027version: 9
1028attrib: const
1029w: 2, 3, 4
1030t: f32
1031ret: #2#1
1032arg: #2#1 a
1033arg: #2 b
1034end:
1035
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001036function: fmin
1037version: UNRELEASED
1038attrib: const
1039w: 2, 3, 4
1040t: f16
1041ret: #2#1
1042arg: #2#1 a
1043arg: #2 b
1044test: none
1045end:
1046
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001047function: fmod
1048version: 9
1049attrib: const
1050w: 1, 2, 3, 4
1051t: f32
1052ret: #2#1
1053arg: #2#1 numerator
1054arg: #2#1 denominator
1055summary: Modulo
1056description:
1057 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1058
1059 The function @remainder() is similar but rounds toward the closest interger.
1060 For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
1061 while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
1062end:
1063
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001064function: fmod
1065version: UNRELEASED
1066attrib: const
1067w: 1, 2, 3, 4
1068t: f16
1069ret: #2#1
1070arg: #2#1 numerator
1071arg: #2#1 denominator
1072test: none
1073end:
1074
1075# TODO Add (both variants) of fract for f16
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001076function: fract
1077version: 9
1078w: 1, 2, 3, 4
1079t: f32
1080ret: #2#1
1081arg: #2#1 v, "Input value."
1082arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
1083summary: Positive fractional part
1084description:
1085 Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
1086
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001087 For example, <code>fract(1.3f, &amp;val)</code> returns 0.3f and sets val to 1.f.
1088 <code>fract(-1.3f, &amp;val)</code> returns 0.7f and sets val to -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001089end:
1090
1091function: fract
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001092version: 9 23
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001093attrib: const
1094w: 1, 2, 3, 4
1095t: f32
1096ret: #2#1
1097arg: #2#1 v
1098inline:
1099 #2#1 unused;
1100 return fract(v, &unused);
1101end:
1102
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001103function: fract
1104version: 24
1105w: 1, 2, 3, 4
1106t: f32
1107ret: #2#1
1108arg: #2#1 v
1109end:
1110
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001111function: fract
1112version: UNRELEASED
1113w: 1, 2, 3, 4
1114t: f16
1115ret: #2#1
1116arg: #2#1 v
1117arg: #2#1* floor
1118test: none
1119end:
1120
1121function: fract
1122version: UNRELEASED
1123w: 1, 2, 3, 4
1124t: f16
1125ret: #2#1
1126arg: #2#1 v
1127test: none
1128end:
1129
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001130# TODO Add f16 frexp
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001131function: frexp
1132version: 9
1133w: 1, 2, 3, 4
1134t: f32
1135ret: #2#1
1136arg: #2#1 v, "Input value."
1137arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1138summary: Binary mantissa and exponent
1139description:
1140 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1141
1142 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1143
1144 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1145end:
1146
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001147function: frexp
1148version: UNRELEASED
1149w: 1, 2, 3, 4
1150t: f16
1151ret: #2#1
1152arg: #2#1 v
1153arg: int#1* exponent
1154test: none
1155end:
1156
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001157function: half_recip
1158version: 17
1159attrib: const
1160w: 1, 2, 3, 4
1161t: f32
1162ret: #2#1
1163arg: #2#1 v
1164summary: Reciprocal computed to 16 bit precision
1165description:
1166 Returns the approximate reciprocal of a value.
1167
1168 The precision is that of a 16 bit floating point value.
1169
1170 See also @native_recip().
1171end:
1172
1173function: half_rsqrt
1174version: 17
1175attrib: const
1176w: 1, 2, 3, 4
1177t: f32
1178ret: #2#1
1179arg: #2#1 v
1180summary: Reciprocal of a square root computed to 16 bit precision
1181description:
1182 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1183
1184 The precision is that of a 16 bit floating point value.
1185
1186 See also @rsqrt(), @native_rsqrt().
1187end:
1188
1189function: half_sqrt
1190version: 17
1191attrib: const
1192w: 1, 2, 3, 4
1193t: f32
1194ret: #2#1
1195arg: #2#1 v
1196summary: Square root computed to 16 bit precision
1197description:
1198 Returns the approximate square root of a value.
1199
1200 The precision is that of a 16 bit floating point value.
1201
1202 See also @sqrt(), @native_sqrt().
1203end:
1204
1205function: hypot
1206version: 9
1207attrib: const
1208w: 1, 2, 3, 4
1209t: f32
1210ret: #2#1
1211arg: #2#1 a
1212arg: #2#1 b
1213summary: Hypotenuse
1214description:
1215 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1216
1217 See also @native_hypot().
1218end:
1219
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001220function: hypot
1221version: UNRELEASED
1222attrib: const
1223w: 1, 2, 3, 4
1224t: f16
1225ret: #2#1
1226arg: #2#1 a
1227arg: #2#1 b
1228test: none
1229end:
1230
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001231function: ilogb
1232version: 9
1233attrib: const
1234w: 1, 2, 3, 4
1235t: f32
1236ret: int#1
1237arg: float#1 v
1238summary: Base two exponent
1239description:
1240 Returns the base two exponent of a value, where the mantissa is between
1241 1.f (inclusive) and 2.f (exclusive).
1242
1243 For example, <code>ilogb(8.5f)</code> returns 3.
1244
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001245 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001246
1247 @logb() is similar but returns a float.
1248test: custom
1249end:
1250
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001251function: ilogb
1252version: UNRELEASED
1253attrib: const
1254w: 1, 2, 3, 4
1255t: f16
1256ret: int#1
1257arg: half#1 v
1258test: none
1259end:
1260
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001261function: ldexp
1262version: 9
1263attrib: const
1264w: 1, 2, 3, 4
1265ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001266arg: float#1 mantissa, "Mantissa."
1267arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001268summary: Creates a floating point from mantissa and exponent
1269description:
1270 Returns the floating point created from the mantissa and exponent,
1271 i.e. (mantissa * 2 ^ exponent).
1272
1273 See @frexp() for the reverse operation.
1274end:
1275
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001276function: ldexp
1277version: UNRELEASED
1278attrib: const
1279w: 1, 2, 3, 4
1280ret: half#1
1281arg: half#1 mantissa
1282arg: int#1 exponent
1283test: none
1284end:
1285
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001286function: ldexp
1287version: 9
1288attrib: const
1289w: 2, 3, 4
1290ret: float#1
1291arg: float#1 mantissa
1292arg: int exponent
1293end:
1294
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001295function: ldexp
1296version: UNRELEASED
1297attrib: const
1298w: 2, 3, 4
1299ret: half#1
1300arg: half#1 mantissa
1301arg: int exponent
1302test: none
1303end:
1304
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001305function: lgamma
1306version: 9
1307attrib: const
1308w: 1, 2, 3, 4
1309t: f32
1310ret: #2#1
1311arg: #2#1 v
1312summary: Natural logarithm of the gamma function
1313description:
1314 Returns the natural logarithm of the absolute value of the gamma function,
1315 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1316
1317 See also @tgamma().
1318end:
1319
1320function: lgamma
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001321version: UNRELEASED
1322attrib: const
1323w: 1, 2, 3, 4
1324t: f16
1325ret: #2#1
1326arg: #2#1 v
1327test: none
1328end:
1329
1330function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001331version: 9
1332w: 1, 2, 3, 4
1333t: f32
1334ret: #2#1
1335arg: #2#1 v
1336arg: 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."
1337test: custom
1338#TODO Temporary until bionic & associated drivers are fixed
1339end:
1340
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001341function: lgamma
1342version: UNRELEASED
1343w: 1, 2, 3, 4
1344t: f16
1345ret: #2#1
1346arg: #2#1 v
1347arg: int#1* sign_of_gamma
1348test: none
1349end:
1350
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001351function: log
1352version: 9
1353attrib: const
1354w: 1, 2, 3, 4
1355t: f32
1356ret: #2#1
1357arg: #2#1 v
1358summary: Natural logarithm
1359description:
1360 Returns the natural logarithm.
1361
1362 See also @native_log().
1363end:
1364
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001365function: log
1366version: UNRELEASED
1367attrib: const
1368w: 1, 2, 3, 4
1369t: f16
1370ret: #2#1
1371arg: #2#1 v
1372test: none
1373end:
1374
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001375function: log10
1376version: 9
1377attrib: const
1378w: 1, 2, 3, 4
1379t: f32
1380ret: #2#1
1381arg: #2#1 v
1382summary: Base 10 logarithm
1383description:
1384 Returns the base 10 logarithm.
1385
1386 See also @native_log10().
1387end:
1388
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001389function: log10
1390version: UNRELEASED
1391attrib: const
1392w: 1, 2, 3, 4
1393t: f16
1394ret: #2#1
1395arg: #2#1 v
1396test: none
1397end:
1398
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001399function: log1p
1400version: 9
1401attrib: const
1402w: 1, 2, 3, 4
1403t: f32
1404ret: #2#1
1405arg: #2#1 v
1406summary: Natural logarithm of a value plus 1
1407description:
1408 Returns the natural logarithm of <code>(v + 1.f)</code>.
1409
1410 See also @native_log1p().
1411end:
1412
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001413function: log1p
1414version: UNRELEASED
1415attrib: const
1416w: 1, 2, 3, 4
1417t: f16
1418ret: #2#1
1419arg: #2#1 v
1420test: none
1421end:
1422
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001423function: log2
1424version: 9
1425attrib: const
1426w: 1, 2, 3, 4
1427t: f32
1428ret: #2#1
1429arg: #2#1 v
1430summary: Base 2 logarithm
1431description:
1432 Returns the base 2 logarithm.
1433
1434 See also @native_log2().
1435end:
1436
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001437function: log2
1438version: UNRELEASED
1439attrib: const
1440w: 1, 2, 3, 4
1441t: f16
1442ret: #2#1
1443arg: #2#1 v
1444test: none
1445end:
1446
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001447function: logb
1448version: 9
1449attrib: const
1450w: 1, 2, 3, 4
1451t: f32
1452ret: #2#1
1453arg: #2#1 v
1454summary: Base two exponent
1455description:
1456 Returns the base two exponent of a value, where the mantissa is between
1457 1.f (inclusive) and 2.f (exclusive).
1458
1459 For example, <code>logb(8.5f)</code> returns 3.f.
1460
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001461 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001462
1463 @ilogb() is similar but returns an integer.
1464end:
1465
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001466function: logb
1467version: UNRELEASED
1468attrib: const
1469w: 1, 2, 3, 4
1470t: f16
1471ret: #2#1
1472arg: #2#1 v
1473test: none
1474end:
1475
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001476function: mad
1477version: 9
1478attrib: const
1479w: 1, 2, 3, 4
1480t: f32
1481ret: #2#1
1482arg: #2#1 multiplicand1
1483arg: #2#1 multiplicand2
1484arg: #2#1 offset
1485summary: Multiply and add
1486description:
1487 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1488
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001489 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1490 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1491 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001492end:
1493
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001494function: mad
1495version: UNRELEASED
1496attrib: const
1497w: 1, 2, 3, 4
1498t: f16
1499ret: #2#1
1500arg: #2#1 multiplicand1
1501arg: #2#1 multiplicand2
1502arg: #2#1 offset
1503test: none
1504end:
1505
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001506function: max
1507version: 9
1508attrib: const
1509w: 1, 2, 3, 4
1510t: f32
1511ret: #2#1
1512arg: #2#1 a
1513arg: #2#1 b
1514summary: Maximum
1515description:
1516 Returns the maximum value of two arguments.
1517end:
1518
1519function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001520version:UNRELEASED
1521attrib: const
1522w: 1, 2, 3, 4
1523t: f16
1524ret: #2#1
1525arg: #2#1 a
1526arg: #2#1 b
1527test: none
1528end:
1529
1530function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001531version: 9
1532attrib: const
1533w: 2, 3, 4
1534t: f32
1535ret: #2#1
1536arg: #2#1 a
1537arg: #2 b
1538end:
1539
1540function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001541version: UNRELEASED
1542attrib: const
1543w: 2, 3, 4
1544t: f16
1545ret: #2#1
1546arg: #2#1 a
1547arg: #2 b
1548test: none
1549end:
1550
1551function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001552version: 9 20
1553attrib: const
1554w: 1
1555t: i8, i16, i32, u8, u16, u32
1556ret: #2#1
1557arg: #2#1 a
1558arg: #2#1 b
1559inline:
1560 return (a > b ? a : b);
1561end:
1562
1563function: max
1564version: 9 20
1565attrib: const
1566w: 2
1567t: i8, i16, i32, u8, u16, u32
1568ret: #2#1
1569arg: #2#1 a
1570arg: #2#1 b
1571inline:
1572 #2#1 tmp;
1573 tmp.x = (a.x > b.x ? a.x : b.x);
1574 tmp.y = (a.y > b.y ? a.y : b.y);
1575 return tmp;
1576end:
1577
1578function: max
1579version: 9 20
1580attrib: const
1581w: 3
1582t: i8, i16, i32, u8, u16, u32
1583ret: #2#1
1584arg: #2#1 a
1585arg: #2#1 b
1586inline:
1587 #2#1 tmp;
1588 tmp.x = (a.x > b.x ? a.x : b.x);
1589 tmp.y = (a.y > b.y ? a.y : b.y);
1590 tmp.z = (a.z > b.z ? a.z : b.z);
1591 return tmp;
1592end:
1593
1594function: max
1595version: 9 20
1596attrib: const
1597w: 4
1598t: i8, i16, i32, u8, u16, u32
1599ret: #2#1
1600arg: #2#1 a
1601arg: #2#1 b
1602inline:
1603 #2#1 tmp;
1604 tmp.x = (a.x > b.x ? a.x : b.x);
1605 tmp.y = (a.y > b.y ? a.y : b.y);
1606 tmp.z = (a.z > b.z ? a.z : b.z);
1607 tmp.w = (a.w > b.w ? a.w : b.w);
1608 return tmp;
1609end:
1610
1611function: max
1612version: 21
1613attrib: const
1614w: 1, 2, 3, 4
1615t: i8, i16, i32, i64, u8, u16, u32, u64
1616ret: #2#1
1617arg: #2#1 a
1618arg: #2#1 b
1619end:
1620
1621function: min
1622version: 9
1623attrib: const
1624w: 1, 2, 3, 4
1625t: f32
1626ret: #2#1
1627arg: #2#1 a
1628arg: #2#1 b
1629summary: Minimum
1630description:
1631 Returns the minimum value of two arguments.
1632end:
1633
1634function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001635version: UNRELEASED
1636attrib: const
1637w: 1, 2, 3, 4
1638t: f16
1639ret: #2#1
1640arg: #2#1 a
1641arg: #2#1 b
1642test: none
1643end:
1644
1645function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001646version: 9
1647attrib: const
1648w: 2, 3, 4
1649t: f32
1650ret: #2#1
1651arg: #2#1 a
1652arg: #2 b
1653end:
1654
1655function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001656version: UNRELEASED
1657attrib: const
1658w: 2, 3, 4
1659t: f16
1660ret: #2#1
1661arg: #2#1 a
1662arg: #2 b
1663test: none
1664end:
1665
1666function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001667version: 9 20
1668attrib: const
1669w: 1
1670t: i8, i16, i32, u8, u16, u32
1671ret: #2#1
1672arg: #2#1 a
1673arg: #2#1 b
1674inline:
1675 return (a < b ? a : b);
1676end:
1677
1678function: min
1679version: 9 20
1680attrib: const
1681w: 2
1682t: i8, i16, i32, u8, u16, u32
1683ret: #2#1
1684arg: #2#1 a
1685arg: #2#1 b
1686inline:
1687 #2#1 tmp;
1688 tmp.x = (a.x < b.x ? a.x : b.x);
1689 tmp.y = (a.y < b.y ? a.y : b.y);
1690 return tmp;
1691end:
1692
1693function: min
1694version: 9 20
1695attrib: const
1696w: 3
1697t: i8, i16, i32, u8, u16, u32
1698ret: #2#1
1699arg: #2#1 a
1700arg: #2#1 b
1701inline:
1702 #2#1 tmp;
1703 tmp.x = (a.x < b.x ? a.x : b.x);
1704 tmp.y = (a.y < b.y ? a.y : b.y);
1705 tmp.z = (a.z < b.z ? a.z : b.z);
1706 return tmp;
1707end:
1708
1709function: min
1710version: 9 20
1711attrib: const
1712w: 4
1713t: i8, i16, i32, u8, u16, u32
1714ret: #2#1
1715arg: #2#1 a
1716arg: #2#1 b
1717inline:
1718 #2#1 tmp;
1719 tmp.x = (a.x < b.x ? a.x : b.x);
1720 tmp.y = (a.y < b.y ? a.y : b.y);
1721 tmp.z = (a.z < b.z ? a.z : b.z);
1722 tmp.w = (a.w < b.w ? a.w : b.w);
1723 return tmp;
1724end:
1725
1726function: min
1727version: 21
1728attrib: const
1729w: 1, 2, 3, 4
1730t: i8, i16, i32, i64, u8, u16, u32, u64
1731ret: #2#1
1732arg: #2#1 a
1733arg: #2#1 b
1734end:
1735
1736function: mix
1737version: 9
1738attrib: const
1739w: 1, 2, 3, 4
1740t: f32
1741ret: #2#1
1742arg: #2#1 start
1743arg: #2#1 stop
1744arg: #2#1 fraction
1745summary: Mixes two values
1746description:
1747 Returns start + ((stop - start) * fraction).
1748
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001749 This can be useful for mixing two values. For example, to create a new color that is
1750 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001751end:
1752
1753function: mix
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001754version: UNRELEASED
1755attrib: const
1756w: 1, 2, 3, 4
1757t: f16
1758ret: #2#1
1759arg: #2#1 start
1760arg: #2#1 stop
1761arg: #2#1 fraction
1762test: none
1763end:
1764
1765function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001766version: 9
1767attrib: const
1768w: 2, 3, 4
1769t: f32
1770ret: #2#1
1771arg: #2#1 start
1772arg: #2#1 stop
1773arg: #2 fraction
1774end:
1775
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001776function: mix
1777version: UNRELEASED
1778attrib: const
1779w: 2, 3, 4
1780t: f16
1781ret: #2#1
1782arg: #2#1 start
1783arg: #2#1 stop
1784arg: #2 fraction
1785test: none
1786end:
1787
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001788function: modf
1789version: 9
1790w: 1, 2, 3, 4
1791t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001792ret: #2#1, "Floating point portion of the value."
1793arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001794arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1795summary: Integral and fractional components
1796description:
1797 Returns the integral and fractional components of a number.
1798
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001799 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 -08001800 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001801end:
1802
Pirama Arumuga Nainar91ad8912016-02-05 16:50:13 -08001803function: modf
1804version: UNRELEASED
1805w: 1, 2, 3, 4
1806t: f16
1807ret: #2#1
1808arg: #2#1 v
1809arg: #2#1* integral_part
1810test: none
1811end:
1812
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001813function: nan
1814version: 9
1815attrib: const
1816w: 1
1817t: f32
1818ret: #2#1
1819arg: uint#1 v, "Not used."
1820#TODO We're not using the argument. Once we do, add this documentation line:
1821# The argument is embedded into the return value and can be used to distinguish various NaNs.
1822summary: Not a Number
1823description:
1824 Returns a NaN value (Not a Number).
1825end:
1826
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001827function: nan_half
1828version: UNRELEASED
1829attrib: const
1830t: f16
1831ret: #1
1832summary: Not a Number
1833description:
1834 Returns a half-precision floating point NaN value (Not a Number).
1835test: none
1836end:
1837
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001838function: native_acos
1839version: 21
1840attrib: const
1841w: 1, 2, 3, 4
1842t: f32
1843ret: #2#1
1844arg: #2#1 v, range(-1,1)
1845summary: Approximate inverse cosine
1846description:
1847 Returns the approximate inverse cosine, in radians.
1848
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001849 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001850
1851 See also @acos().
1852# TODO Temporary
1853test: limited(0.0005)
1854end:
1855
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001856function: native_acos
1857version: UNRELEASED
1858attrib: const
1859w: 1, 2, 3, 4
1860t: f16
1861ret: #2#1
1862# TODO Need range(-1,1) here similar to the float version?
1863arg: #2#1 v
1864test: none
1865end:
1866
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001867function: native_acosh
1868version: 21
1869attrib: const
1870w: 1, 2, 3, 4
1871t: f32
1872ret: #2#1
1873arg: #2#1 v
1874summary: Approximate inverse hyperbolic cosine
1875description:
1876 Returns the approximate inverse hyperbolic cosine, in radians.
1877
1878 See also @acosh().
1879# TODO Temporary
1880test: limited(0.0005)
1881end:
1882
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001883function: native_acosh
1884version: UNRELEASED
1885attrib: const
1886w: 1, 2, 3, 4
1887t: f16
1888ret: #2#1
1889arg: #2#1 v
1890test: none
1891end:
1892
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001893function: native_acospi
1894version: 21
1895attrib: const
1896w: 1, 2, 3, 4
1897t: f32
1898ret: #2#1
1899arg: #2#1 v, range(-1,1)
1900summary: Approximate inverse cosine divided by pi
1901description:
1902 Returns the approximate inverse cosine in radians, divided by pi.
1903
1904 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1905
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001906 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001907
1908 See also @acospi().
1909# TODO Temporary
1910test: limited(0.0005)
1911end:
1912
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001913function: native_acospi
1914version: UNRELEASED
1915attrib: const
1916w: 1, 2, 3, 4
1917t: f16
1918ret: #2#1
1919# TODO Need range(-1,1) here similar to the float version?
1920arg: #2#1 v
1921test: none
1922end:
1923
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001924function: native_asin
1925version: 21
1926attrib: const
1927w: 1, 2, 3, 4
1928t: f32
1929ret: #2#1
1930arg: #2#1 v, range(-1,1)
1931summary: Approximate inverse sine
1932description:
1933 Returns the approximate inverse sine, in radians.
1934
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001935 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001936
1937 See also @asin().
1938# TODO Temporary
1939test: limited(0.0005)
1940end:
1941
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001942function: native_asin
1943version: UNRELEASED
1944attrib: const
1945w: 1, 2, 3, 4
1946t: f16
1947ret: #2#1
1948# TODO Need range(-1,1) here similar to the float version?
1949arg: #2#1 v
1950test: none
1951end:
1952
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001953function: native_asinh
1954version: 21
1955attrib: const
1956w: 1, 2, 3, 4
1957t: f32
1958ret: #2#1
1959arg: #2#1 v
1960summary: Approximate inverse hyperbolic sine
1961description:
1962 Returns the approximate inverse hyperbolic sine, in radians.
1963
1964 See also @asinh().
1965# TODO Temporary
1966test: limited(0.0005)
1967end:
1968
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001969function: native_asinh
1970version: UNRELEASED
1971attrib: const
1972w: 1, 2, 3, 4
1973t: f16
1974ret: #2#1
1975arg: #2#1 v
1976test: none
1977end:
1978
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001979function: native_asinpi
1980version: 21
1981attrib: const
1982w: 1, 2, 3, 4
1983t: f32
1984ret: #2#1
1985arg: #2#1 v, range(-1,1)
1986summary: Approximate inverse sine divided by pi
1987description:
1988 Returns the approximate inverse sine in radians, divided by pi.
1989
1990 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1991
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001992 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001993
1994 See also @asinpi().
1995# TODO Temporary
1996test: limited(0.0005)
1997end:
1998
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001999function: native_asinpi
2000version: UNRELEASED
2001attrib: const
2002w: 1, 2, 3, 4
2003t: f16
2004ret: #2#1
2005# TODO Need range(-1,1) here similar to the float version?
2006arg: #2#1 v
2007test: none
2008end:
2009
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002010function: native_atan
2011version: 21
2012attrib: const
2013w: 1, 2, 3, 4
2014t: f32
2015ret: #2#1
2016arg: #2#1 v, range(-1,1)
2017summary: Approximate inverse tangent
2018description:
2019 Returns the approximate inverse tangent, in radians.
2020
2021 See also @atan().
2022# TODO Temporary
2023test: limited(0.0005)
2024end:
2025
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002026function: native_atan
2027version: UNRELEASED
2028attrib: const
2029w: 1, 2, 3, 4
2030t: f16
2031ret: #2#1
2032# TODO Need range(-1,1) here similar to the float version?
2033arg: #2#1 v
2034test: none
2035end:
2036
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002037function: native_atan2
2038version: 21
2039attrib: const
2040w: 1, 2, 3, 4
2041t: f32
2042ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002043arg: #2#1 numerator, "Numerator."
2044arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002045summary: Approximate inverse tangent of a ratio
2046description:
2047 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
2048
2049 See also @atan2().
2050# TODO Temporary
2051test: limited(0.0005)
2052end:
2053
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002054function: native_atan2
2055version: UNRELEASED
2056attrib: const
2057w: 1, 2, 3, 4
2058t: f16
2059ret: #2#1
2060arg: #2#1 numerator
2061arg: #2#1 denominator
2062test: none
2063end:
2064
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002065function: native_atan2pi
2066version: 21
2067attrib: const
2068w: 1, 2, 3, 4
2069t: f32
2070ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002071arg: #2#1 numerator, "Numerator."
2072arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002073summary: Approximate inverse tangent of a ratio, divided by pi
2074description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002075 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2076 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002077
2078 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2079
2080 See also @atan2pi().
2081# TODO Temporary
2082test: limited(0.0005)
2083end:
2084
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002085function: native_atan2pi
2086version: UNRELEASED
2087attrib: const
2088w: 1, 2, 3, 4
2089t: f16
2090ret: #2#1
2091arg: #2#1 numerator
2092arg: #2#1 denominator
2093test: none
2094end:
2095
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002096function: native_atanh
2097version: 21
2098attrib: const
2099w: 1, 2, 3, 4
2100t: f32
2101ret: #2#1
2102arg: #2#1 v, range(-1,1)
2103summary: Approximate inverse hyperbolic tangent
2104description:
2105 Returns the approximate inverse hyperbolic tangent, in radians.
2106
2107 See also @atanh().
2108# TODO Temporary
2109test: limited(0.0005)
2110end:
2111
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002112function: native_atanh
2113version: UNRELEASED
2114attrib: const
2115w: 1, 2, 3, 4
2116t: f16
2117ret: #2#1
2118# TODO Need range(-1,1) here similar to the float version?
2119arg: #2#1 v
2120test: none
2121end:
2122
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002123function: native_atanpi
2124version: 21
2125attrib: const
2126w: 1, 2, 3, 4
2127t: f32
2128ret: #2#1
2129arg: #2#1 v, range(-1,1)
2130summary: Approximate inverse tangent divided by pi
2131description:
2132 Returns the approximate inverse tangent in radians, divided by pi.
2133
2134 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2135
2136 See also @atanpi().
2137# TODO Temporary
2138test: limited(0.0005)
2139end:
2140
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002141function: native_atanpi
2142version: UNRELEASED
2143attrib: const
2144w: 1, 2, 3, 4
2145t: f16
2146ret: #2#1
2147# TODO Need range(-1,1) here similar to the float version?
2148arg: #2#1 v
2149test: none
2150end:
2151
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002152function: native_cbrt
2153version: 21
2154attrib: const
2155w: 1, 2, 3, 4
2156t: f32
2157ret: #2#1
2158arg: #2#1 v
2159summary: Approximate cube root
2160description:
2161 Returns the approximate cubic root.
2162
2163 See also @cbrt().
2164end:
2165
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002166function: native_cbrt
2167version: UNRELEASED
2168attrib: const
2169w: 1, 2, 3, 4
2170t: f16
2171ret: #2#1
2172arg: #2#1 v
2173test: none
2174end:
2175
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002176function: native_cos
2177version: 21
2178attrib: const
2179w: 1, 2, 3, 4
2180t: f32
2181ret: #2#1
2182arg: #2#1 v
2183summary: Approximate cosine
2184description:
2185 Returns the approximate cosine of an angle measured in radians.
2186
2187 See also @cos().
2188end:
2189
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002190function: native_cos
2191version: UNRELEASED
2192attrib: const
2193w: 1, 2, 3, 4
2194t: f16
2195ret: #2#1
2196arg: #2#1 v
2197test: none
2198end:
2199
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002200function: native_cosh
2201version: 21
2202attrib: const
2203w: 1, 2, 3, 4
2204t: f32
2205ret: #2#1
2206arg: #2#1 v
2207summary: Approximate hypebolic cosine
2208description:
2209 Returns the approximate hypebolic cosine.
2210
2211 See also @cosh().
2212end:
2213
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002214function: native_cosh
2215version: UNRELEASED
2216attrib: const
2217w: 1, 2, 3, 4
2218t: f16
2219ret: #2#1
2220arg: #2#1 v
2221test: none
2222end:
2223
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002224function: native_cospi
2225version: 21
2226attrib: const
2227w: 1, 2, 3, 4
2228t: f32
2229ret: #2#1
2230arg: #2#1 v
2231summary: Approximate cosine of a number multiplied by pi
2232description:
2233 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2234
2235 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2236
2237 See also @cospi().
2238end:
2239
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002240function: native_cospi
2241version: UNRELEASED
2242attrib: const
2243w: 1, 2, 3, 4
2244t: f16
2245ret: #2#1
2246arg: #2#1 v
2247test: none
2248end:
2249
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002250function: native_divide
2251version: 21
2252attrib: const
2253w: 1, 2, 3, 4
2254t: f32
2255ret: #2#1
2256arg: #2#1 left_vector
2257arg: #2#1 right_vector
2258summary: Approximate division
2259description:
2260 Computes the approximate division of two values.
2261end:
2262
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002263function: native_divide
2264version: UNRELEASED
2265attrib: const
2266w: 1, 2, 3, 4
2267t: f16
2268ret: #2#1
2269arg: #2#1 left_vector
2270arg: #2#1 right_vector
2271test: none
2272end:
2273
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002274function: native_exp
2275version: 18
2276attrib: const
2277w: 1, 2, 3, 4
2278t: f32
2279ret: #2#1
2280arg: #2#1 v, range(-86,86)
2281summary: Approximate e raised to a number
2282description:
2283 Fast approximate exp.
2284
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002285 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2286 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002287
2288 See also @exp().
2289test: limited
2290end:
2291
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002292function: native_exp
2293version: UNRELEASED
2294attrib: const
2295w: 1, 2, 3, 4
2296t: f16
2297ret: #2#1
2298# TODO Need range(-86, 86) here similar to the float version?
2299arg: #2#1 v
2300test: none
2301end:
2302
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002303function: native_exp10
2304version: 18
2305attrib: const
2306w: 1, 2, 3, 4
2307t: f32
2308ret: #2#1
2309arg: #2#1 v, range(-37,37)
2310summary: Approximate 10 raised to a number
2311description:
2312 Fast approximate exp10.
2313
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002314 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2315 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002316
2317 See also @exp10().
2318test: limited
2319end:
2320
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002321function: native_exp10
2322version: UNRELEASED
2323attrib: const
2324w: 1, 2, 3, 4
2325t: f16
2326ret: #2#1
2327# TODO Need range(-37, 37) here similar to the float version?
2328arg: #2#1 v
2329test: none
2330end:
2331
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002332function: native_exp2
2333version: 18
2334attrib: const
2335w: 1, 2, 3, 4
2336t: f32
2337ret: #2#1
2338arg: #2#1 v, range(-125,125)
2339summary: Approximate 2 raised to a number
2340description:
2341 Fast approximate exp2.
2342
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002343 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2344 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002345
2346 See also @exp2().
2347test: limited
2348end:
2349
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002350function: native_exp2
2351version: UNRELEASED
2352attrib: const
2353w: 1, 2, 3, 4
2354t: f16
2355ret: #2#1
2356# TODO Need range(-125, 125) here similar to the float version?
2357arg: #2#1 v
2358test: none
2359end:
2360
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002361function: native_expm1
2362version: 21
2363attrib: const
2364w: 1, 2, 3, 4
2365t: f32
2366ret: #2#1
2367arg: #2#1 v
2368summary: Approximate e raised to a number minus one
2369description:
2370 Returns the approximate (e ^ v) - 1.
2371
2372 See also @expm1().
2373end:
2374
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002375function: native_expm1
2376version: UNRELEASED
2377attrib: const
2378w: 1, 2, 3, 4
2379t: f16
2380ret: #2#1
2381arg: #2#1 v
2382test: none
2383end:
2384
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002385function: native_hypot
2386version: 21
2387attrib: const
2388w: 1, 2, 3, 4
2389t: f32
2390ret: #2#1
2391arg: #2#1 a
2392arg: #2#1 b
2393summary: Approximate hypotenuse
2394description:
2395 Returns the approximate native_sqrt(a * a + b * b)
2396
2397 See also @hypot().
2398end:
2399
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002400function: native_hypot
2401version: UNRELEASED
2402attrib: const
2403w: 1, 2, 3, 4
2404t: f16
2405ret: #2#1
2406arg: #2#1 a
2407arg: #2#1 b
2408test: none
2409end:
2410
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002411function: native_log
2412version: 18
2413attrib: const
2414w: 1, 2, 3, 4
2415t: f32
2416ret: #2#1
2417arg: #2#1 v, range(10e-10,10e10)
2418summary: Approximate natural logarithm
2419description:
2420 Fast approximate log.
2421
2422 It is not accurate for values very close to zero.
2423
2424 See also @log().
2425test: limited
2426end:
2427
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002428function: native_log
2429version: UNRELEASED
2430attrib: const
2431w: 1, 2, 3, 4
2432t: f16
2433ret: #2#1
2434# TODO Need range(10e-10,10e10) here similar to the float version?
2435arg: #2#1 v
2436test: none
2437end:
2438
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002439function: native_log10
2440version: 18
2441attrib: const
2442w: 1, 2, 3, 4
2443t: f32
2444ret: #2#1
2445arg: #2#1 v, range(10e-10,10e10)
2446summary: Approximate base 10 logarithm
2447description:
2448 Fast approximate log10.
2449
2450 It is not accurate for values very close to zero.
2451
2452 See also @log10().
2453test: limited
2454end:
2455
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002456function: native_log10
2457version: UNRELEASED
2458attrib: const
2459w: 1, 2, 3, 4
2460t: f16
2461ret: #2#1
2462# TODO Need range(10e-10,10e10) here similar to the float version?
2463arg: #2#1 v
2464test: none
2465end:
2466
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002467function: native_log1p
2468version: 21
2469attrib: const
2470w: 1, 2, 3, 4
2471t: f32
2472ret: #2#1
2473arg: #2#1 v
2474summary: Approximate natural logarithm of a value plus 1
2475description:
2476 Returns the approximate natural logarithm of (v + 1.0f)
2477
2478 See also @log1p().
2479end:
2480
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002481function: native_log1p
2482version: UNRELEASED
2483attrib: const
2484w: 1, 2, 3, 4
2485t: f16
2486ret: #2#1
2487arg: #2#1 v
2488test: none
2489end:
2490
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002491function: native_log2
2492version: 18
2493attrib: const
2494w: 1, 2, 3, 4
2495t: f32
2496ret: #2#1
2497arg: #2#1 v, range(10e-10,10e10)
2498summary: Approximate base 2 logarithm
2499description:
2500 Fast approximate log2.
2501
2502 It is not accurate for values very close to zero.
2503
2504 See also @log2().
2505test: limited
2506end:
2507
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002508function: native_log2
2509version: UNRELEASED
2510attrib: const
2511w: 1, 2, 3, 4
2512t: f16
2513ret: #2#1
2514# TODO Need range(10e-10,10e10) here similar to the float version?
2515arg: #2#1 v
2516test: none
2517end:
2518
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002519function: native_powr
2520version: 18
2521attrib: const
2522w: 1, 2, 3, 4
2523t: f32
2524ret: #2#1
2525arg: #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."
2526arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2527summary: Approximate positive base raised to an exponent
2528description:
2529 Fast approximate (base ^ exponent).
2530
2531 See also @powr().
2532test: limited
2533end:
2534
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002535function: native_powr
2536version: UNRELEASED
2537attrib: const
2538w: 1, 2, 3, 4
2539t: f16
2540ret: #2#1
2541# TODO Need range(0, 256) here similar to the float version?
2542arg: #2#1 base
2543# TODO Need range(-15,15) here similar to the float version?
2544arg: #2#1 exponent
2545test: none
2546end:
2547
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002548function: native_recip
2549version: 21
2550attrib: const
2551w: 1, 2, 3, 4
2552t: f32
2553ret: #2#1
2554arg: #2#1 v
2555summary: Approximate reciprocal
2556description:
2557 Returns the approximate approximate reciprocal of a value.
2558
2559 See also @half_recip().
2560end:
2561
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002562function: native_recip
2563version: UNRELEASED
2564attrib: const
2565w: 1, 2, 3, 4
2566t: f16
2567ret: #2#1
2568arg: #2#1 v
2569test: none
2570end:
2571
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002572function: native_rootn
2573version: 21
2574attrib: const
2575w: 1, 2, 3, 4
2576t: f32
2577ret: #2#1
2578arg: #2#1 v
2579arg: int#1 n
2580summary: Approximate nth root
2581description:
2582 Compute the approximate Nth root of a value.
2583
2584 See also @rootn().
2585end:
2586
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002587function: native_rootn
2588version: UNRELEASED
2589attrib: const
2590w: 1, 2, 3, 4
2591t: f16
2592ret: #2#1
2593arg: #2#1 v
2594arg: int#1 n
2595test: none
2596end:
2597
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002598function: native_rsqrt
2599version: 21
2600attrib: const
2601w: 1, 2, 3, 4
2602t: f32
2603ret: #2#1
2604arg: #2#1 v
2605summary: Approximate reciprocal of a square root
2606description:
2607 Returns approximate (1 / sqrt(v)).
2608
2609 See also @rsqrt(), @half_rsqrt().
2610end:
2611
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002612function: native_rsqrt
2613version: UNRELEASED
2614attrib: const
2615w: 1, 2, 3, 4
2616t: f16
2617ret: #2#1
2618arg: #2#1 v
2619test: none
2620end:
2621
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002622function: native_sin
2623version: 21
2624attrib: const
2625w: 1, 2, 3, 4
2626t: f32
2627ret: #2#1
2628arg: #2#1 v
2629summary: Approximate sine
2630description:
2631 Returns the approximate sine of an angle measured in radians.
2632
2633 See also @sin().
2634end:
2635
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002636function: native_sin
2637version: UNRELEASED
2638attrib: const
2639w: 1, 2, 3, 4
2640t: f16
2641ret: #2#1
2642arg: #2#1 v
2643test: none
2644end:
2645
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002646function: native_sincos
2647version: 21
2648w: 1, 2, 3, 4
2649t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002650ret: #2#1, "Sine."
2651arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002652arg: #2#1* cos, "*cos will be set to the cosine value."
2653summary: Approximate sine and cosine
2654description:
2655 Returns the approximate sine and cosine of a value.
2656
2657 See also @sincos().
2658# TODO Temporary
2659test: limited(0.0005)
2660end:
2661
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002662function: native_sincos
2663version: UNRELEASED
2664w: 1, 2, 3, 4
2665t: f16
2666ret: #2#1
2667arg: #2#1 v
2668arg: #2#1* cos
2669test: none
2670end:
2671
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002672function: native_sinh
2673version: 21
2674attrib: const
2675w: 1, 2, 3, 4
2676t: f32
2677ret: #2#1
2678arg: #2#1 v
2679summary: Approximate hyperbolic sine
2680description:
2681 Returns the approximate hyperbolic sine of a value specified in radians.
2682
2683 See also @sinh().
2684end:
2685
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002686function: native_sinh
2687version: UNRELEASED
2688attrib: const
2689w: 1, 2, 3, 4
2690t: f16
2691ret: #2#1
2692arg: #2#1 v
2693test: none
2694end:
2695
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002696function: native_sinpi
2697version: 21
2698attrib: const
2699w: 1, 2, 3, 4
2700t: f32
2701ret: #2#1
2702arg: #2#1 v
2703summary: Approximate sine of a number multiplied by pi
2704description:
2705 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2706
2707 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2708
2709 See also @sinpi().
2710end:
2711
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002712function: native_sinpi
2713version: UNRELEASED
2714attrib: const
2715w: 1, 2, 3, 4
2716t: f16
2717ret: #2#1
2718arg: #2#1 v
2719test: none
2720end:
2721
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002722function: native_sqrt
2723version: 21
2724attrib: const
2725w: 1, 2, 3, 4
2726t: f32
2727ret: #2#1
2728arg: #2#1 v
2729summary: Approximate square root
2730description:
2731 Returns the approximate sqrt(v).
2732
2733 See also @sqrt(), @half_sqrt().
2734end:
2735
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002736function: native_sqrt
2737version: UNRELEASED
2738attrib: const
2739w: 1, 2, 3, 4
2740t: f16
2741ret: #2#1
2742arg: #2#1 v
2743test: none
2744end:
2745
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002746function: native_tan
2747version: 21
2748attrib: const
2749w: 1, 2, 3, 4
2750t: f32
2751ret: #2#1
2752arg: #2#1 v
2753summary: Approximate tangent
2754description:
2755 Returns the approximate tangent of an angle measured in radians.
2756end:
2757
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002758function: native_tan
2759version: UNRELEASED
2760attrib: const
2761w: 1, 2, 3, 4
2762t: f16
2763ret: #2#1
2764arg: #2#1 v
2765test: none
2766end:
2767
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002768function: native_tanh
2769version: 21
2770attrib: const
2771w: 1, 2, 3, 4
2772t: f32
2773ret: #2#1
2774arg: #2#1 v
2775summary: Approximate hyperbolic tangent
2776description:
2777 Returns the approximate hyperbolic tangent of a value.
2778
2779 See also @tanh().
2780end:
2781
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002782function: native_tanh
2783version: UNRELEASED
2784attrib: const
2785w: 1, 2, 3, 4
2786t: f16
2787ret: #2#1
2788arg: #2#1 v
2789test: none
2790end:
2791
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002792function: native_tanpi
2793version: 21
2794attrib: const
2795w: 1, 2, 3, 4
2796t: f32
2797ret: #2#1
2798arg: #2#1 v
2799summary: Approximate tangent of a number multiplied by pi
2800description:
2801 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2802
2803 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2804
2805 See also @tanpi().
2806end:
2807
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002808function: native_tanpi
2809version: UNRELEASED
2810attrib: const
2811w: 1, 2, 3, 4
2812t: f16
2813ret: #2#1
2814arg: #2#1 v
2815test: none
2816end:
2817
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002818function: nextafter
2819version: 9
2820attrib: const
2821w: 1, 2, 3, 4
2822t: f32
2823ret: #2#1
2824arg: #2#1 v
2825arg: #2#1 target
2826summary: Next floating point number
2827description:
2828 Returns the next representable floating point number from v towards target.
2829
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002830 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2831 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002832end:
2833
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002834function: nextafter
2835version: UNRELEASED
2836attrib: const
2837w: 1, 2, 3, 4
2838t: f16
2839ret: #2#1
2840arg: #2#1 v
2841arg: #2#1 target
2842test: none
2843end:
2844
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002845function: pow
2846version: 9
2847attrib: const
2848w: 1, 2, 3, 4
2849t: f32
2850ret: #2#1
2851arg: #2#1 base
2852arg: #2#1 exponent
2853summary: Base raised to an exponent
2854description:
2855 Returns base raised to the power exponent, i.e. base ^ exponent.
2856
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002857 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2858 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002859end:
2860
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002861function: pow
2862version: UNRELEASED
2863attrib: const
2864w: 1, 2, 3, 4
2865t: f16
2866ret: #2#1
2867arg: #2#1 base
2868arg: #2#1 exponent
2869test: none
2870end:
2871
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002872function: pown
2873version: 9
2874attrib: const
2875w: 1, 2, 3, 4
2876t: f32
2877ret: #2#1
2878arg: #2#1 base
2879arg: int#1 exponent
2880summary: Base raised to an integer exponent
2881description:
2882 Returns base raised to the power exponent, i.e. base ^ exponent.
2883
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002884 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2885 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002886end:
2887
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002888function: pown
2889version: UNRELEASED
2890attrib: const
2891w: 1, 2, 3, 4
2892t: f16
2893ret: #2#1
2894arg: #2#1 base
2895arg: int#1 exponent
2896test: none
2897end:
2898
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002899function: powr
2900version: 9
2901attrib: const
2902w: 1, 2, 3, 4
2903t: f32
2904ret: #2#1
2905arg: #2#1 base, range(0,3000)
2906arg: #2#1 exponent
2907summary: Positive base raised to an exponent
2908description:
2909 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2910
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002911 @pow() and @pown() are similar. They both make no assumptions about the base.
2912 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002913
2914 See also @native_powr().
2915end:
2916
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002917function: powr
2918version: UNRELEASED
2919attrib: const
2920w: 1, 2, 3, 4
2921t: f16
2922ret: #2#1
2923# TODO Need range(0,3000) here similar to the float version?
2924arg: #2#1 base
2925arg: #2#1 exponent
2926test: none
2927end:
2928
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002929function: radians
2930version: 9
2931attrib: const
2932w: 1, 2, 3, 4
2933t: f32
2934ret: #2#1
2935arg: #2#1 v
2936summary: Converts degrees into radians
2937description:
2938 Converts from degrees to radians.
2939end:
2940
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002941function: radians
2942version: UNRELEASED
2943attrib: const
2944w: 1, 2, 3, 4
2945t: f16
2946ret: #2#1
2947arg: #2#1 v
2948test: none
2949end:
2950
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002951function: remainder
2952version: 9
2953attrib: const
2954w: 1, 2, 3, 4
2955t: f32
2956ret: #2#1
2957arg: #2#1 numerator
2958arg: #2#1 denominator
2959summary: Remainder of a division
2960description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002961 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2962 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002963
2964 The function @fmod() is similar but rounds toward the closest interger.
2965 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2966 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2967end:
2968
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002969function: remainder
2970version: UNRELEASED
2971attrib: const
2972w: 1, 2, 3, 4
2973t: f16
2974ret: #2#1
2975arg: #2#1 numerator
2976arg: #2#1 denominator
2977test: none
2978end:
2979
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002980function: remquo
2981version: 9
2982w: 1, 2, 3, 4
2983t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002984ret: #2#1, "Remainder, precise only for the low three bits."
2985arg: #2#1 numerator, "Numerator."
2986arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002987arg: int#1* quotient, "*quotient will be set to the integer quotient."
2988summary: Remainder and quotient of a division
2989description:
2990 Returns the quotient and the remainder of (numerator / denominator).
2991
2992 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2993
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002994 This function is useful for implementing periodic functions. The low three bits of the
2995 quotient gives the quadrant and the remainder the distance within the quadrant.
2996 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2997 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002998
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002999 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
3000 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003001test: custom
3002end:
3003
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003004function: remquo
3005version: UNRELEASED
3006w: 1, 2, 3, 4
3007t: f16
3008ret: #2#1
3009arg: #2#1 numerator
3010arg: #2#1 denominator
3011arg: int#1* quotient
3012test: none
3013end:
3014
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003015function: rint
3016version: 9
3017attrib: const
3018w: 1, 2, 3, 4
3019t: f32
3020ret: #2#1
3021arg: #2#1 v
3022summary: Round to even
3023description:
3024 Rounds to the nearest integral value.
3025
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003026 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
3027 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
3028 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003029
3030 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
3031end:
3032
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003033function: rint
3034version: UNRELEASED
3035attrib: const
3036w: 1, 2, 3, 4
3037t: f16
3038ret: #2#1
3039arg: #2#1 v
3040test: none
3041end:
3042
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003043function: rootn
3044version: 9
3045attrib: const
3046w: 1, 2, 3, 4
3047t: f32
3048ret: #2#1
3049arg: #2#1 v
3050arg: int#1 n
3051summary: Nth root
3052description:
3053 Compute the Nth root of a value.
3054
3055 See also @native_rootn().
3056end:
3057
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003058function: rootn
3059version: UNRELEASED
3060attrib: const
3061w: 1, 2, 3, 4
3062t: f16
3063ret: #2#1
3064arg: #2#1 v
3065arg: int#1 n
3066test: none
3067end:
3068
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003069function: round
3070version: 9
3071attrib: const
3072w: 1, 2, 3, 4
3073t: f32
3074ret: #2#1
3075arg: #2#1 v
3076summary: Round away from zero
3077description:
3078 Round to the nearest integral value.
3079
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003080 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
3081 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
3082 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003083
3084 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
3085end:
3086
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003087function: round
3088version: UNRELEASED
3089attrib: const
3090w: 1, 2, 3, 4
3091t: f16
3092ret: #2#1
3093arg: #2#1 v
3094test: none
3095end:
3096
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003097function: rsqrt
3098version: 9
3099attrib: const
3100w: 1, 2, 3, 4
3101t: f32
3102ret: #2#1
3103arg: #2#1 v
3104summary: Reciprocal of a square root
3105description:
3106 Returns (1 / sqrt(v)).
3107
3108 See also @half_rsqrt(), @native_rsqrt().
3109end:
3110
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003111function: rsqrt
3112version: UNRELEASED
3113attrib: const
3114w: 1, 2, 3, 4
3115t: f16
3116ret: #2#1
3117arg: #2#1 v
3118test: none
3119end:
3120
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003121function: sign
3122version: 9
3123attrib: const
3124w: 1, 2, 3, 4
3125t: f32
3126ret: #2#1
3127arg: #2#1 v
3128summary: Sign of a value
3129description:
3130 Returns the sign of a value.
3131
3132 if (v &lt; 0) return -1.f;
3133 else if (v &gt; 0) return 1.f;
3134 else return 0.f;
3135end:
3136
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003137function: sign
3138version:UNRELEASED
3139attrib: const
3140w: 1, 2, 3, 4
3141t: f16
3142ret: #2#1
3143arg: #2#1 v
3144test: none
3145end:
3146
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003147function: sin
3148version: 9
3149attrib: const
3150w: 1, 2, 3, 4
3151t: f32
3152ret: #2#1
3153arg: #2#1 v
3154summary: Sine
3155description:
3156 Returns the sine of an angle measured in radians.
3157
3158 See also @native_sin().
3159end:
3160
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003161function: sin
3162version: UNRELEASED
3163attrib: const
3164w: 1, 2, 3, 4
3165t: f16
3166ret: #2#1
3167arg: #2#1 v
3168test: none
3169end:
3170
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003171function: sincos
3172version: 9
3173w: 1, 2, 3, 4
3174t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003175ret: #2#1, "Sine of v."
3176arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003177arg: #2#1* cos, "*cos will be set to the cosine value."
3178summary: Sine and cosine
3179description:
3180 Returns the sine and cosine of a value.
3181
3182 See also @native_sincos().
3183end:
3184
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003185function: sincos
3186version: UNRELEASED
3187w: 1, 2, 3, 4
3188t: f16
3189ret: #2#1
3190arg: #2#1 v
3191arg: #2#1* cos
3192test: none
3193end:
3194
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003195function: sinh
3196version: 9
3197attrib: const
3198w: 1, 2, 3, 4
3199t: f32
3200ret: #2#1
3201arg: #2#1 v
3202summary: Hyperbolic sine
3203description:
3204 Returns the hyperbolic sine of v, where v is measured in radians.
3205
3206 See also @native_sinh().
3207end:
3208
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003209function: sinh
3210version: UNRELEASED
3211attrib: const
3212w: 1, 2, 3, 4
3213t: f16
3214ret: #2#1
3215arg: #2#1 v
3216test: none
3217end:
3218
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003219function: sinpi
3220version: 9
3221attrib: const
3222w: 1, 2, 3, 4
3223t: f32
3224ret: #2#1
3225arg: #2#1 v
3226summary: Sine of a number multiplied by pi
3227description:
3228 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3229
3230 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3231
3232 See also @native_sinpi().
3233end:
3234
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003235function: sinpi
3236version: UNRELEASED
3237attrib: const
3238w: 1, 2, 3, 4
3239t: f16
3240ret: #2#1
3241arg: #2#1 v
3242test: none
3243end:
3244
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003245function: sqrt
3246version: 9
3247attrib: const
3248w: 1, 2, 3, 4
3249t: f32
3250ret: #2#1
3251arg: #2#1 v
3252summary: Square root
3253description:
3254 Returns the square root of a value.
3255
3256 See also @half_sqrt(), @native_sqrt().
3257end:
3258
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003259function: sqrt
3260version: UNRELEASED
3261attrib: const
3262w: 1, 2, 3, 4
3263t: f16
3264ret: #2#1
3265arg: #2#1 v
3266test: none
3267end:
3268
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003269function: step
3270version: 9
3271attrib: const
3272w: 1, 2, 3, 4
3273t: f32
3274ret: #2#1
3275arg: #2#1 edge
3276arg: #2#1 v
3277summary: 0 if less than a value, 0 otherwise
3278description:
3279 Returns 0.f if v &lt; edge, 1.f otherwise.
3280
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003281 This can be useful to create conditional computations without using loops and branching
3282 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3283 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 -07003284end:
3285
3286function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003287version: UNRELEASED
3288attrib: const
3289w: 1, 2, 3, 4
3290t: f16
3291ret: #2#1
3292arg: #2#1 edge
3293arg: #2#1 v
3294test: none
3295end:
3296
3297function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003298version: 9
3299attrib: const
3300w: 2, 3, 4
3301t: f32
3302ret: #2#1
3303arg: #2#1 edge
3304arg: #2 v
3305end:
3306
3307function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003308version: UNRELEASED
3309attrib: const
3310w: 2, 3, 4
3311t: f16
3312ret: #2#1
3313arg: #2#1 edge
3314arg: #2 v
3315test: none
3316end:
3317
3318function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003319version: 21
3320attrib: const
3321w: 2, 3, 4
3322t: f32
3323ret: #2#1
3324arg: #2 edge
3325arg: #2#1 v
3326end:
3327
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003328function: step
3329version: UNRELEASED
3330attrib: const
3331w: 2, 3, 4
3332t: f16
3333ret: #2#1
3334arg: #2 edge
3335arg: #2#1 v
3336test: none
3337end:
3338
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003339function: tan
3340version: 9
3341attrib: const
3342w: 1, 2, 3, 4
3343t: f32
3344ret: #2#1
3345arg: #2#1 v
3346summary: Tangent
3347description:
3348 Returns the tangent of an angle measured in radians.
3349
3350 See also @native_tan().
3351end:
3352
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003353function: tan
3354version: UNRELEASED
3355attrib: const
3356w: 1, 2, 3, 4
3357t: f16
3358ret: #2#1
3359arg: #2#1 v
3360test: none
3361end:
3362
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003363function: tanh
3364version: 9
3365attrib: const
3366w: 1, 2, 3, 4
3367t: f32
3368ret: #2#1
3369arg: #2#1 v
3370summary: Hyperbolic tangent
3371description:
3372 Returns the hyperbolic tangent of a value.
3373
3374 See also @native_tanh().
3375end:
3376
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003377function: tanh
3378version: UNRELEASED
3379attrib: const
3380w: 1, 2, 3, 4
3381t: f16
3382ret: #2#1
3383arg: #2#1 v
3384test: none
3385end:
3386
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003387function: tanpi
3388version: 9
3389attrib: const
3390w: 1, 2, 3, 4
3391t: f32
3392ret: #2#1
3393arg: #2#1 v
3394summary: Tangent of a number multiplied by pi
3395description:
3396 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3397
3398 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3399
3400 See also @native_tanpi().
3401end:
3402
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003403function: tanpi
3404version: UNRELEASED
3405attrib: const
3406w: 1, 2, 3, 4
3407t: f16
3408ret: #2#1
3409arg: #2#1 v
3410test: none
3411end:
3412
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003413function: tgamma
3414version: 9
3415attrib: const
3416w: 1, 2, 3, 4
3417t: f32
3418ret: #2#1
3419arg: #2#1 v
3420summary: Gamma function
3421description:
3422 Returns the gamma function of a value.
3423
3424 See also @lgamma().
3425end:
3426
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003427function: tgamma
3428version: UNRELEASED
3429attrib: const
3430w: 1, 2, 3, 4
3431t: f16
3432ret: #2#1
3433arg: #2#1 v
3434test: none
3435end:
3436
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003437function: trunc
3438version: 9
3439attrib: const
3440w: 1, 2, 3, 4
3441t: f32
3442ret: #2#1
3443arg: #2#1 v
3444summary: Truncates a floating point
3445description:
3446 Rounds to integral using truncation.
3447
3448 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3449
3450 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003451end:
3452
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003453function: trunc
3454version: UNRELEASED
3455attrib: const
3456w: 1, 2, 3, 4
3457t: f16
3458ret: #2#1
3459arg: #2#1 v
3460test: none
3461end:
3462
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003463function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003464attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003465t: i8, i16, i32, u8, u16, u32
3466ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003467arg: #1 amount, "Value to clamp."
3468arg: #1 low, "Lower bound."
3469arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003470deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003471summary: Restrain a value to a range
3472description:
3473 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003474test: none
3475end:
3476
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003477function: rsFrac
3478attrib: const
3479ret: float
3480arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003481deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003482summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003483description:
3484 Returns the fractional part of a float
3485test: none
3486end:
3487
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003488function: rsRand
3489ret: int
3490arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003491summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003492description:
3493 Return a random value between 0 (or min_value) and max_malue.
3494test: none
3495end:
3496
3497function: rsRand
3498ret: int
3499arg: int min_value
3500arg: int max_value
3501test: none
3502end:
3503
3504function: rsRand
3505ret: float
3506arg: float max_value
3507test: none
3508end:
3509
3510function: rsRand
3511ret: float
3512arg: float min_value
3513arg: float max_value
3514test: none
3515end: