blob: 47c1964899053a75b193aca70cc54243f5ac4a15 [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 Nainar193847b2015-12-09 15:54:35 -08001111# TODO Add f16 frexp
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001112function: frexp
1113version: 9
1114w: 1, 2, 3, 4
1115t: f32
1116ret: #2#1
1117arg: #2#1 v, "Input value."
1118arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1119summary: Binary mantissa and exponent
1120description:
1121 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1122
1123 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1124
1125 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1126end:
1127
1128function: half_recip
1129version: 17
1130attrib: const
1131w: 1, 2, 3, 4
1132t: f32
1133ret: #2#1
1134arg: #2#1 v
1135summary: Reciprocal computed to 16 bit precision
1136description:
1137 Returns the approximate reciprocal of a value.
1138
1139 The precision is that of a 16 bit floating point value.
1140
1141 See also @native_recip().
1142end:
1143
1144function: half_rsqrt
1145version: 17
1146attrib: const
1147w: 1, 2, 3, 4
1148t: f32
1149ret: #2#1
1150arg: #2#1 v
1151summary: Reciprocal of a square root computed to 16 bit precision
1152description:
1153 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1154
1155 The precision is that of a 16 bit floating point value.
1156
1157 See also @rsqrt(), @native_rsqrt().
1158end:
1159
1160function: half_sqrt
1161version: 17
1162attrib: const
1163w: 1, 2, 3, 4
1164t: f32
1165ret: #2#1
1166arg: #2#1 v
1167summary: Square root computed to 16 bit precision
1168description:
1169 Returns the approximate square root of a value.
1170
1171 The precision is that of a 16 bit floating point value.
1172
1173 See also @sqrt(), @native_sqrt().
1174end:
1175
1176function: hypot
1177version: 9
1178attrib: const
1179w: 1, 2, 3, 4
1180t: f32
1181ret: #2#1
1182arg: #2#1 a
1183arg: #2#1 b
1184summary: Hypotenuse
1185description:
1186 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1187
1188 See also @native_hypot().
1189end:
1190
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001191function: hypot
1192version: UNRELEASED
1193attrib: const
1194w: 1, 2, 3, 4
1195t: f16
1196ret: #2#1
1197arg: #2#1 a
1198arg: #2#1 b
1199test: none
1200end:
1201
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001202function: ilogb
1203version: 9
1204attrib: const
1205w: 1, 2, 3, 4
1206t: f32
1207ret: int#1
1208arg: float#1 v
1209summary: Base two exponent
1210description:
1211 Returns the base two exponent of a value, where the mantissa is between
1212 1.f (inclusive) and 2.f (exclusive).
1213
1214 For example, <code>ilogb(8.5f)</code> returns 3.
1215
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001216 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001217
1218 @logb() is similar but returns a float.
1219test: custom
1220end:
1221
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08001222function: ilogb
1223version: UNRELEASED
1224attrib: const
1225w: 1, 2, 3, 4
1226t: f16
1227ret: int#1
1228arg: half#1 v
1229test: none
1230end:
1231
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001232function: ldexp
1233version: 9
1234attrib: const
1235w: 1, 2, 3, 4
1236ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001237arg: float#1 mantissa, "Mantissa."
1238arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001239summary: Creates a floating point from mantissa and exponent
1240description:
1241 Returns the floating point created from the mantissa and exponent,
1242 i.e. (mantissa * 2 ^ exponent).
1243
1244 See @frexp() for the reverse operation.
1245end:
1246
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001247# TODO Should this parameter be a short?
1248function: ldexp
1249version: UNRELEASED
1250attrib: const
1251w: 1, 2, 3, 4
1252ret: half#1
1253arg: half#1 mantissa
1254arg: int#1 exponent
1255test: none
1256end:
1257
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001258function: ldexp
1259version: 9
1260attrib: const
1261w: 2, 3, 4
1262ret: float#1
1263arg: float#1 mantissa
1264arg: int exponent
1265end:
1266
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001267function: ldexp
1268version: UNRELEASED
1269attrib: const
1270w: 2, 3, 4
1271ret: half#1
1272arg: half#1 mantissa
1273arg: int exponent
1274test: none
1275end:
1276
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001277function: lgamma
1278version: 9
1279attrib: const
1280w: 1, 2, 3, 4
1281t: f32
1282ret: #2#1
1283arg: #2#1 v
1284summary: Natural logarithm of the gamma function
1285description:
1286 Returns the natural logarithm of the absolute value of the gamma function,
1287 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1288
1289 See also @tgamma().
1290end:
1291
1292function: lgamma
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001293version: UNRELEASED
1294attrib: const
1295w: 1, 2, 3, 4
1296t: f16
1297ret: #2#1
1298arg: #2#1 v
1299test: none
1300end:
1301
1302function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001303version: 9
1304w: 1, 2, 3, 4
1305t: f32
1306ret: #2#1
1307arg: #2#1 v
1308arg: 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."
1309test: custom
1310#TODO Temporary until bionic & associated drivers are fixed
1311end:
1312
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001313function: lgamma
1314version: UNRELEASED
1315w: 1, 2, 3, 4
1316t: f16
1317ret: #2#1
1318arg: #2#1 v
1319arg: int#1* sign_of_gamma
1320test: none
1321end:
1322
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001323function: log
1324version: 9
1325attrib: const
1326w: 1, 2, 3, 4
1327t: f32
1328ret: #2#1
1329arg: #2#1 v
1330summary: Natural logarithm
1331description:
1332 Returns the natural logarithm.
1333
1334 See also @native_log().
1335end:
1336
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001337function: log
1338version: UNRELEASED
1339attrib: const
1340w: 1, 2, 3, 4
1341t: f16
1342ret: #2#1
1343arg: #2#1 v
1344test: none
1345end:
1346
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001347function: log10
1348version: 9
1349attrib: const
1350w: 1, 2, 3, 4
1351t: f32
1352ret: #2#1
1353arg: #2#1 v
1354summary: Base 10 logarithm
1355description:
1356 Returns the base 10 logarithm.
1357
1358 See also @native_log10().
1359end:
1360
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001361function: log10
1362version: UNRELEASED
1363attrib: const
1364w: 1, 2, 3, 4
1365t: f16
1366ret: #2#1
1367arg: #2#1 v
1368test: none
1369end:
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
1386version: UNRELEASED
1387attrib: const
1388w: 1, 2, 3, 4
1389t: f16
1390ret: #2#1
1391arg: #2#1 v
1392test: none
1393end:
1394
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001395function: log2
1396version: 9
1397attrib: const
1398w: 1, 2, 3, 4
1399t: f32
1400ret: #2#1
1401arg: #2#1 v
1402summary: Base 2 logarithm
1403description:
1404 Returns the base 2 logarithm.
1405
1406 See also @native_log2().
1407end:
1408
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001409function: log2
1410version: UNRELEASED
1411attrib: const
1412w: 1, 2, 3, 4
1413t: f16
1414ret: #2#1
1415arg: #2#1 v
1416test: none
1417end:
1418
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001419function: logb
1420version: 9
1421attrib: const
1422w: 1, 2, 3, 4
1423t: f32
1424ret: #2#1
1425arg: #2#1 v
1426summary: Base two exponent
1427description:
1428 Returns the base two exponent of a value, where the mantissa is between
1429 1.f (inclusive) and 2.f (exclusive).
1430
1431 For example, <code>logb(8.5f)</code> returns 3.f.
1432
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001433 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001434
1435 @ilogb() is similar but returns an integer.
1436end:
1437
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001438function: logb
1439version: UNRELEASED
1440attrib: const
1441w: 1, 2, 3, 4
1442t: f16
1443ret: #2#1
1444arg: #2#1 v
1445test: none
1446end:
1447
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001448function: mad
1449version: 9
1450attrib: const
1451w: 1, 2, 3, 4
1452t: f32
1453ret: #2#1
1454arg: #2#1 multiplicand1
1455arg: #2#1 multiplicand2
1456arg: #2#1 offset
1457summary: Multiply and add
1458description:
1459 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1460
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001461 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1462 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1463 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001464end:
1465
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001466function: mad
1467version: UNRELEASED
1468attrib: const
1469w: 1, 2, 3, 4
1470t: f16
1471ret: #2#1
1472arg: #2#1 multiplicand1
1473arg: #2#1 multiplicand2
1474arg: #2#1 offset
1475test: none
1476end:
1477
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001478function: max
1479version: 9
1480attrib: const
1481w: 1, 2, 3, 4
1482t: f32
1483ret: #2#1
1484arg: #2#1 a
1485arg: #2#1 b
1486summary: Maximum
1487description:
1488 Returns the maximum value of two arguments.
1489end:
1490
1491function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001492version:UNRELEASED
1493attrib: const
1494w: 1, 2, 3, 4
1495t: f16
1496ret: #2#1
1497arg: #2#1 a
1498arg: #2#1 b
1499test: none
1500end:
1501
1502function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001503version: 9
1504attrib: const
1505w: 2, 3, 4
1506t: f32
1507ret: #2#1
1508arg: #2#1 a
1509arg: #2 b
1510end:
1511
1512function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001513version: UNRELEASED
1514attrib: const
1515w: 2, 3, 4
1516t: f16
1517ret: #2#1
1518arg: #2#1 a
1519arg: #2 b
1520test: none
1521end:
1522
1523function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001524version: 9 20
1525attrib: const
1526w: 1
1527t: i8, i16, i32, u8, u16, u32
1528ret: #2#1
1529arg: #2#1 a
1530arg: #2#1 b
1531inline:
1532 return (a > b ? a : b);
1533end:
1534
1535function: max
1536version: 9 20
1537attrib: const
1538w: 2
1539t: i8, i16, i32, u8, u16, u32
1540ret: #2#1
1541arg: #2#1 a
1542arg: #2#1 b
1543inline:
1544 #2#1 tmp;
1545 tmp.x = (a.x > b.x ? a.x : b.x);
1546 tmp.y = (a.y > b.y ? a.y : b.y);
1547 return tmp;
1548end:
1549
1550function: max
1551version: 9 20
1552attrib: const
1553w: 3
1554t: i8, i16, i32, u8, u16, u32
1555ret: #2#1
1556arg: #2#1 a
1557arg: #2#1 b
1558inline:
1559 #2#1 tmp;
1560 tmp.x = (a.x > b.x ? a.x : b.x);
1561 tmp.y = (a.y > b.y ? a.y : b.y);
1562 tmp.z = (a.z > b.z ? a.z : b.z);
1563 return tmp;
1564end:
1565
1566function: max
1567version: 9 20
1568attrib: const
1569w: 4
1570t: i8, i16, i32, u8, u16, u32
1571ret: #2#1
1572arg: #2#1 a
1573arg: #2#1 b
1574inline:
1575 #2#1 tmp;
1576 tmp.x = (a.x > b.x ? a.x : b.x);
1577 tmp.y = (a.y > b.y ? a.y : b.y);
1578 tmp.z = (a.z > b.z ? a.z : b.z);
1579 tmp.w = (a.w > b.w ? a.w : b.w);
1580 return tmp;
1581end:
1582
1583function: max
1584version: 21
1585attrib: const
1586w: 1, 2, 3, 4
1587t: i8, i16, i32, i64, u8, u16, u32, u64
1588ret: #2#1
1589arg: #2#1 a
1590arg: #2#1 b
1591end:
1592
1593function: min
1594version: 9
1595attrib: const
1596w: 1, 2, 3, 4
1597t: f32
1598ret: #2#1
1599arg: #2#1 a
1600arg: #2#1 b
1601summary: Minimum
1602description:
1603 Returns the minimum value of two arguments.
1604end:
1605
1606function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001607version: UNRELEASED
1608attrib: const
1609w: 1, 2, 3, 4
1610t: f16
1611ret: #2#1
1612arg: #2#1 a
1613arg: #2#1 b
1614test: none
1615end:
1616
1617function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001618version: 9
1619attrib: const
1620w: 2, 3, 4
1621t: f32
1622ret: #2#1
1623arg: #2#1 a
1624arg: #2 b
1625end:
1626
1627function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001628version: UNRELEASED
1629attrib: const
1630w: 2, 3, 4
1631t: f16
1632ret: #2#1
1633arg: #2#1 a
1634arg: #2 b
1635test: none
1636end:
1637
1638function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001639version: 9 20
1640attrib: const
1641w: 1
1642t: i8, i16, i32, u8, u16, u32
1643ret: #2#1
1644arg: #2#1 a
1645arg: #2#1 b
1646inline:
1647 return (a < b ? a : b);
1648end:
1649
1650function: min
1651version: 9 20
1652attrib: const
1653w: 2
1654t: i8, i16, i32, u8, u16, u32
1655ret: #2#1
1656arg: #2#1 a
1657arg: #2#1 b
1658inline:
1659 #2#1 tmp;
1660 tmp.x = (a.x < b.x ? a.x : b.x);
1661 tmp.y = (a.y < b.y ? a.y : b.y);
1662 return tmp;
1663end:
1664
1665function: min
1666version: 9 20
1667attrib: const
1668w: 3
1669t: i8, i16, i32, u8, u16, u32
1670ret: #2#1
1671arg: #2#1 a
1672arg: #2#1 b
1673inline:
1674 #2#1 tmp;
1675 tmp.x = (a.x < b.x ? a.x : b.x);
1676 tmp.y = (a.y < b.y ? a.y : b.y);
1677 tmp.z = (a.z < b.z ? a.z : b.z);
1678 return tmp;
1679end:
1680
1681function: min
1682version: 9 20
1683attrib: const
1684w: 4
1685t: i8, i16, i32, u8, u16, u32
1686ret: #2#1
1687arg: #2#1 a
1688arg: #2#1 b
1689inline:
1690 #2#1 tmp;
1691 tmp.x = (a.x < b.x ? a.x : b.x);
1692 tmp.y = (a.y < b.y ? a.y : b.y);
1693 tmp.z = (a.z < b.z ? a.z : b.z);
1694 tmp.w = (a.w < b.w ? a.w : b.w);
1695 return tmp;
1696end:
1697
1698function: min
1699version: 21
1700attrib: const
1701w: 1, 2, 3, 4
1702t: i8, i16, i32, i64, u8, u16, u32, u64
1703ret: #2#1
1704arg: #2#1 a
1705arg: #2#1 b
1706end:
1707
1708function: mix
1709version: 9
1710attrib: const
1711w: 1, 2, 3, 4
1712t: f32
1713ret: #2#1
1714arg: #2#1 start
1715arg: #2#1 stop
1716arg: #2#1 fraction
1717summary: Mixes two values
1718description:
1719 Returns start + ((stop - start) * fraction).
1720
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001721 This can be useful for mixing two values. For example, to create a new color that is
1722 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001723end:
1724
1725function: mix
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001726version: UNRELEASED
1727attrib: const
1728w: 1, 2, 3, 4
1729t: f16
1730ret: #2#1
1731arg: #2#1 start
1732arg: #2#1 stop
1733arg: #2#1 fraction
1734test: none
1735end:
1736
1737function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001738version: 9
1739attrib: const
1740w: 2, 3, 4
1741t: f32
1742ret: #2#1
1743arg: #2#1 start
1744arg: #2#1 stop
1745arg: #2 fraction
1746end:
1747
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001748function: mix
1749version: UNRELEASED
1750attrib: const
1751w: 2, 3, 4
1752t: f16
1753ret: #2#1
1754arg: #2#1 start
1755arg: #2#1 stop
1756arg: #2 fraction
1757test: none
1758end:
1759
1760# TODO Add f16 modf
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001761function: modf
1762version: 9
1763w: 1, 2, 3, 4
1764t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001765ret: #2#1, "Floating point portion of the value."
1766arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001767arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1768summary: Integral and fractional components
1769description:
1770 Returns the integral and fractional components of a number.
1771
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001772 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 -08001773 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001774end:
1775
1776function: nan
1777version: 9
1778attrib: const
1779w: 1
1780t: f32
1781ret: #2#1
1782arg: uint#1 v, "Not used."
1783#TODO We're not using the argument. Once we do, add this documentation line:
1784# The argument is embedded into the return value and can be used to distinguish various NaNs.
1785summary: Not a Number
1786description:
1787 Returns a NaN value (Not a Number).
1788end:
1789
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001790function: nan_half
1791version: UNRELEASED
1792attrib: const
1793t: f16
1794ret: #1
1795summary: Not a Number
1796description:
1797 Returns a half-precision floating point NaN value (Not a Number).
1798test: none
1799end:
1800
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001801function: native_acos
1802version: 21
1803attrib: const
1804w: 1, 2, 3, 4
1805t: f32
1806ret: #2#1
1807arg: #2#1 v, range(-1,1)
1808summary: Approximate inverse cosine
1809description:
1810 Returns the approximate inverse cosine, in radians.
1811
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001812 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001813
1814 See also @acos().
1815# TODO Temporary
1816test: limited(0.0005)
1817end:
1818
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001819function: native_acos
1820version: UNRELEASED
1821attrib: const
1822w: 1, 2, 3, 4
1823t: f16
1824ret: #2#1
1825# TODO Need range(-1,1) here similar to the float version?
1826arg: #2#1 v
1827test: none
1828end:
1829
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001830function: native_acosh
1831version: 21
1832attrib: const
1833w: 1, 2, 3, 4
1834t: f32
1835ret: #2#1
1836arg: #2#1 v
1837summary: Approximate inverse hyperbolic cosine
1838description:
1839 Returns the approximate inverse hyperbolic cosine, in radians.
1840
1841 See also @acosh().
1842# TODO Temporary
1843test: limited(0.0005)
1844end:
1845
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001846function: native_acosh
1847version: UNRELEASED
1848attrib: const
1849w: 1, 2, 3, 4
1850t: f16
1851ret: #2#1
1852arg: #2#1 v
1853test: none
1854end:
1855
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001856function: native_acospi
1857version: 21
1858attrib: const
1859w: 1, 2, 3, 4
1860t: f32
1861ret: #2#1
1862arg: #2#1 v, range(-1,1)
1863summary: Approximate inverse cosine divided by pi
1864description:
1865 Returns the approximate inverse cosine in radians, divided by pi.
1866
1867 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1868
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001869 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001870
1871 See also @acospi().
1872# TODO Temporary
1873test: limited(0.0005)
1874end:
1875
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001876function: native_acospi
1877version: UNRELEASED
1878attrib: const
1879w: 1, 2, 3, 4
1880t: f16
1881ret: #2#1
1882# TODO Need range(-1,1) here similar to the float version?
1883arg: #2#1 v
1884test: none
1885end:
1886
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001887function: native_asin
1888version: 21
1889attrib: const
1890w: 1, 2, 3, 4
1891t: f32
1892ret: #2#1
1893arg: #2#1 v, range(-1,1)
1894summary: Approximate inverse sine
1895description:
1896 Returns the approximate inverse sine, in radians.
1897
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001898 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001899
1900 See also @asin().
1901# TODO Temporary
1902test: limited(0.0005)
1903end:
1904
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001905function: native_asin
1906version: UNRELEASED
1907attrib: const
1908w: 1, 2, 3, 4
1909t: f16
1910ret: #2#1
1911# TODO Need range(-1,1) here similar to the float version?
1912arg: #2#1 v
1913test: none
1914end:
1915
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001916function: native_asinh
1917version: 21
1918attrib: const
1919w: 1, 2, 3, 4
1920t: f32
1921ret: #2#1
1922arg: #2#1 v
1923summary: Approximate inverse hyperbolic sine
1924description:
1925 Returns the approximate inverse hyperbolic sine, in radians.
1926
1927 See also @asinh().
1928# TODO Temporary
1929test: limited(0.0005)
1930end:
1931
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001932function: native_asinh
1933version: UNRELEASED
1934attrib: const
1935w: 1, 2, 3, 4
1936t: f16
1937ret: #2#1
1938arg: #2#1 v
1939test: none
1940end:
1941
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001942function: native_asinpi
1943version: 21
1944attrib: const
1945w: 1, 2, 3, 4
1946t: f32
1947ret: #2#1
1948arg: #2#1 v, range(-1,1)
1949summary: Approximate inverse sine divided by pi
1950description:
1951 Returns the approximate inverse sine in radians, divided by pi.
1952
1953 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1954
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001955 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001956
1957 See also @asinpi().
1958# TODO Temporary
1959test: limited(0.0005)
1960end:
1961
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001962function: native_asinpi
1963version: UNRELEASED
1964attrib: const
1965w: 1, 2, 3, 4
1966t: f16
1967ret: #2#1
1968# TODO Need range(-1,1) here similar to the float version?
1969arg: #2#1 v
1970test: none
1971end:
1972
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001973function: native_atan
1974version: 21
1975attrib: const
1976w: 1, 2, 3, 4
1977t: f32
1978ret: #2#1
1979arg: #2#1 v, range(-1,1)
1980summary: Approximate inverse tangent
1981description:
1982 Returns the approximate inverse tangent, in radians.
1983
1984 See also @atan().
1985# TODO Temporary
1986test: limited(0.0005)
1987end:
1988
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001989function: native_atan
1990version: UNRELEASED
1991attrib: const
1992w: 1, 2, 3, 4
1993t: f16
1994ret: #2#1
1995# TODO Need range(-1,1) here similar to the float version?
1996arg: #2#1 v
1997test: none
1998end:
1999
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002000function: native_atan2
2001version: 21
2002attrib: const
2003w: 1, 2, 3, 4
2004t: f32
2005ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002006arg: #2#1 numerator, "Numerator."
2007arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002008summary: Approximate inverse tangent of a ratio
2009description:
2010 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
2011
2012 See also @atan2().
2013# TODO Temporary
2014test: limited(0.0005)
2015end:
2016
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002017function: native_atan2
2018version: UNRELEASED
2019attrib: const
2020w: 1, 2, 3, 4
2021t: f16
2022ret: #2#1
2023arg: #2#1 numerator
2024arg: #2#1 denominator
2025test: none
2026end:
2027
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002028function: native_atan2pi
2029version: 21
2030attrib: const
2031w: 1, 2, 3, 4
2032t: f32
2033ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002034arg: #2#1 numerator, "Numerator."
2035arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002036summary: Approximate inverse tangent of a ratio, divided by pi
2037description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002038 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2039 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002040
2041 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2042
2043 See also @atan2pi().
2044# TODO Temporary
2045test: limited(0.0005)
2046end:
2047
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002048function: native_atan2pi
2049version: UNRELEASED
2050attrib: const
2051w: 1, 2, 3, 4
2052t: f16
2053ret: #2#1
2054arg: #2#1 numerator
2055arg: #2#1 denominator
2056test: none
2057end:
2058
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002059function: native_atanh
2060version: 21
2061attrib: const
2062w: 1, 2, 3, 4
2063t: f32
2064ret: #2#1
2065arg: #2#1 v, range(-1,1)
2066summary: Approximate inverse hyperbolic tangent
2067description:
2068 Returns the approximate inverse hyperbolic tangent, in radians.
2069
2070 See also @atanh().
2071# TODO Temporary
2072test: limited(0.0005)
2073end:
2074
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002075function: native_atanh
2076version: UNRELEASED
2077attrib: const
2078w: 1, 2, 3, 4
2079t: f16
2080ret: #2#1
2081# TODO Need range(-1,1) here similar to the float version?
2082arg: #2#1 v
2083test: none
2084end:
2085
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002086function: native_atanpi
2087version: 21
2088attrib: const
2089w: 1, 2, 3, 4
2090t: f32
2091ret: #2#1
2092arg: #2#1 v, range(-1,1)
2093summary: Approximate inverse tangent divided by pi
2094description:
2095 Returns the approximate inverse tangent in radians, divided by pi.
2096
2097 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2098
2099 See also @atanpi().
2100# TODO Temporary
2101test: limited(0.0005)
2102end:
2103
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002104function: native_atanpi
2105version: UNRELEASED
2106attrib: const
2107w: 1, 2, 3, 4
2108t: f16
2109ret: #2#1
2110# TODO Need range(-1,1) here similar to the float version?
2111arg: #2#1 v
2112test: none
2113end:
2114
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002115function: native_cbrt
2116version: 21
2117attrib: const
2118w: 1, 2, 3, 4
2119t: f32
2120ret: #2#1
2121arg: #2#1 v
2122summary: Approximate cube root
2123description:
2124 Returns the approximate cubic root.
2125
2126 See also @cbrt().
2127end:
2128
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002129function: native_cbrt
2130version: UNRELEASED
2131attrib: const
2132w: 1, 2, 3, 4
2133t: f16
2134ret: #2#1
2135arg: #2#1 v
2136test: none
2137end:
2138
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002139function: native_cos
2140version: 21
2141attrib: const
2142w: 1, 2, 3, 4
2143t: f32
2144ret: #2#1
2145arg: #2#1 v
2146summary: Approximate cosine
2147description:
2148 Returns the approximate cosine of an angle measured in radians.
2149
2150 See also @cos().
2151end:
2152
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002153function: native_cos
2154version: UNRELEASED
2155attrib: const
2156w: 1, 2, 3, 4
2157t: f16
2158ret: #2#1
2159arg: #2#1 v
2160test: none
2161end:
2162
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002163function: native_cosh
2164version: 21
2165attrib: const
2166w: 1, 2, 3, 4
2167t: f32
2168ret: #2#1
2169arg: #2#1 v
2170summary: Approximate hypebolic cosine
2171description:
2172 Returns the approximate hypebolic cosine.
2173
2174 See also @cosh().
2175end:
2176
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002177function: native_cosh
2178version: UNRELEASED
2179attrib: const
2180w: 1, 2, 3, 4
2181t: f16
2182ret: #2#1
2183arg: #2#1 v
2184test: none
2185end:
2186
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002187function: native_cospi
2188version: 21
2189attrib: const
2190w: 1, 2, 3, 4
2191t: f32
2192ret: #2#1
2193arg: #2#1 v
2194summary: Approximate cosine of a number multiplied by pi
2195description:
2196 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2197
2198 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2199
2200 See also @cospi().
2201end:
2202
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002203function: native_cospi
2204version: UNRELEASED
2205attrib: const
2206w: 1, 2, 3, 4
2207t: f16
2208ret: #2#1
2209arg: #2#1 v
2210test: none
2211end:
2212
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002213function: native_divide
2214version: 21
2215attrib: const
2216w: 1, 2, 3, 4
2217t: f32
2218ret: #2#1
2219arg: #2#1 left_vector
2220arg: #2#1 right_vector
2221summary: Approximate division
2222description:
2223 Computes the approximate division of two values.
2224end:
2225
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002226function: native_divide
2227version: UNRELEASED
2228attrib: const
2229w: 1, 2, 3, 4
2230t: f16
2231ret: #2#1
2232arg: #2#1 left_vector
2233arg: #2#1 right_vector
2234test: none
2235end:
2236
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002237function: native_exp
2238version: 18
2239attrib: const
2240w: 1, 2, 3, 4
2241t: f32
2242ret: #2#1
2243arg: #2#1 v, range(-86,86)
2244summary: Approximate e raised to a number
2245description:
2246 Fast approximate exp.
2247
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002248 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2249 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002250
2251 See also @exp().
2252test: limited
2253end:
2254
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002255function: native_exp
2256version: UNRELEASED
2257attrib: const
2258w: 1, 2, 3, 4
2259t: f16
2260ret: #2#1
2261# TODO Need range(-86, 86) here similar to the float version?
2262arg: #2#1 v
2263test: none
2264end:
2265
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002266function: native_exp10
2267version: 18
2268attrib: const
2269w: 1, 2, 3, 4
2270t: f32
2271ret: #2#1
2272arg: #2#1 v, range(-37,37)
2273summary: Approximate 10 raised to a number
2274description:
2275 Fast approximate exp10.
2276
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002277 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2278 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002279
2280 See also @exp10().
2281test: limited
2282end:
2283
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002284function: native_exp10
2285version: UNRELEASED
2286attrib: const
2287w: 1, 2, 3, 4
2288t: f16
2289ret: #2#1
2290# TODO Need range(-37, 37) here similar to the float version?
2291arg: #2#1 v
2292test: none
2293end:
2294
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002295function: native_exp2
2296version: 18
2297attrib: const
2298w: 1, 2, 3, 4
2299t: f32
2300ret: #2#1
2301arg: #2#1 v, range(-125,125)
2302summary: Approximate 2 raised to a number
2303description:
2304 Fast approximate exp2.
2305
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002306 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2307 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002308
2309 See also @exp2().
2310test: limited
2311end:
2312
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002313function: native_exp2
2314version: UNRELEASED
2315attrib: const
2316w: 1, 2, 3, 4
2317t: f16
2318ret: #2#1
2319# TODO Need range(-125, 125) here similar to the float version?
2320arg: #2#1 v
2321test: none
2322end:
2323
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002324function: native_expm1
2325version: 21
2326attrib: const
2327w: 1, 2, 3, 4
2328t: f32
2329ret: #2#1
2330arg: #2#1 v
2331summary: Approximate e raised to a number minus one
2332description:
2333 Returns the approximate (e ^ v) - 1.
2334
2335 See also @expm1().
2336end:
2337
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002338function: native_expm1
2339version: UNRELEASED
2340attrib: const
2341w: 1, 2, 3, 4
2342t: f16
2343ret: #2#1
2344arg: #2#1 v
2345test: none
2346end:
2347
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002348function: native_hypot
2349version: 21
2350attrib: const
2351w: 1, 2, 3, 4
2352t: f32
2353ret: #2#1
2354arg: #2#1 a
2355arg: #2#1 b
2356summary: Approximate hypotenuse
2357description:
2358 Returns the approximate native_sqrt(a * a + b * b)
2359
2360 See also @hypot().
2361end:
2362
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002363function: native_hypot
2364version: UNRELEASED
2365attrib: const
2366w: 1, 2, 3, 4
2367t: f16
2368ret: #2#1
2369arg: #2#1 a
2370arg: #2#1 b
2371test: none
2372end:
2373
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002374function: native_log
2375version: 18
2376attrib: const
2377w: 1, 2, 3, 4
2378t: f32
2379ret: #2#1
2380arg: #2#1 v, range(10e-10,10e10)
2381summary: Approximate natural logarithm
2382description:
2383 Fast approximate log.
2384
2385 It is not accurate for values very close to zero.
2386
2387 See also @log().
2388test: limited
2389end:
2390
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002391function: native_log
2392version: UNRELEASED
2393attrib: const
2394w: 1, 2, 3, 4
2395t: f16
2396ret: #2#1
2397# TODO Need range(10e-10,10e10) here similar to the float version?
2398arg: #2#1 v
2399test: none
2400end:
2401
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002402function: native_log10
2403version: 18
2404attrib: const
2405w: 1, 2, 3, 4
2406t: f32
2407ret: #2#1
2408arg: #2#1 v, range(10e-10,10e10)
2409summary: Approximate base 10 logarithm
2410description:
2411 Fast approximate log10.
2412
2413 It is not accurate for values very close to zero.
2414
2415 See also @log10().
2416test: limited
2417end:
2418
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002419function: native_log10
2420version: UNRELEASED
2421attrib: const
2422w: 1, 2, 3, 4
2423t: f16
2424ret: #2#1
2425# TODO Need range(10e-10,10e10) here similar to the float version?
2426arg: #2#1 v
2427test: none
2428end:
2429
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002430function: native_log1p
2431version: 21
2432attrib: const
2433w: 1, 2, 3, 4
2434t: f32
2435ret: #2#1
2436arg: #2#1 v
2437summary: Approximate natural logarithm of a value plus 1
2438description:
2439 Returns the approximate natural logarithm of (v + 1.0f)
2440
2441 See also @log1p().
2442end:
2443
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002444function: native_log1p
2445version: UNRELEASED
2446attrib: const
2447w: 1, 2, 3, 4
2448t: f16
2449ret: #2#1
2450arg: #2#1 v
2451test: none
2452end:
2453
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002454function: native_log2
2455version: 18
2456attrib: const
2457w: 1, 2, 3, 4
2458t: f32
2459ret: #2#1
2460arg: #2#1 v, range(10e-10,10e10)
2461summary: Approximate base 2 logarithm
2462description:
2463 Fast approximate log2.
2464
2465 It is not accurate for values very close to zero.
2466
2467 See also @log2().
2468test: limited
2469end:
2470
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002471function: native_log2
2472version: UNRELEASED
2473attrib: const
2474w: 1, 2, 3, 4
2475t: f16
2476ret: #2#1
2477# TODO Need range(10e-10,10e10) here similar to the float version?
2478arg: #2#1 v
2479test: none
2480end:
2481
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002482function: native_powr
2483version: 18
2484attrib: const
2485w: 1, 2, 3, 4
2486t: f32
2487ret: #2#1
2488arg: #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."
2489arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2490summary: Approximate positive base raised to an exponent
2491description:
2492 Fast approximate (base ^ exponent).
2493
2494 See also @powr().
2495test: limited
2496end:
2497
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002498function: native_powr
2499version: UNRELEASED
2500attrib: const
2501w: 1, 2, 3, 4
2502t: f16
2503ret: #2#1
2504# TODO Need range(0, 256) here similar to the float version?
2505arg: #2#1 base
2506# TODO Need range(-15,15) here similar to the float version?
2507arg: #2#1 exponent
2508test: none
2509end:
2510
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002511function: native_recip
2512version: 21
2513attrib: const
2514w: 1, 2, 3, 4
2515t: f32
2516ret: #2#1
2517arg: #2#1 v
2518summary: Approximate reciprocal
2519description:
2520 Returns the approximate approximate reciprocal of a value.
2521
2522 See also @half_recip().
2523end:
2524
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002525function: native_recip
2526version: UNRELEASED
2527attrib: const
2528w: 1, 2, 3, 4
2529t: f16
2530ret: #2#1
2531arg: #2#1 v
2532test: none
2533end:
2534
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002535function: native_rootn
2536version: 21
2537attrib: const
2538w: 1, 2, 3, 4
2539t: f32
2540ret: #2#1
2541arg: #2#1 v
2542arg: int#1 n
2543summary: Approximate nth root
2544description:
2545 Compute the approximate Nth root of a value.
2546
2547 See also @rootn().
2548end:
2549
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002550function: native_rootn
2551version: UNRELEASED
2552attrib: const
2553w: 1, 2, 3, 4
2554t: f16
2555ret: #2#1
2556arg: #2#1 v
2557arg: int#1 n
2558test: none
2559end:
2560
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002561function: native_rsqrt
2562version: 21
2563attrib: const
2564w: 1, 2, 3, 4
2565t: f32
2566ret: #2#1
2567arg: #2#1 v
2568summary: Approximate reciprocal of a square root
2569description:
2570 Returns approximate (1 / sqrt(v)).
2571
2572 See also @rsqrt(), @half_rsqrt().
2573end:
2574
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002575function: native_rsqrt
2576version: UNRELEASED
2577attrib: const
2578w: 1, 2, 3, 4
2579t: f16
2580ret: #2#1
2581arg: #2#1 v
2582test: none
2583end:
2584
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002585function: native_sin
2586version: 21
2587attrib: const
2588w: 1, 2, 3, 4
2589t: f32
2590ret: #2#1
2591arg: #2#1 v
2592summary: Approximate sine
2593description:
2594 Returns the approximate sine of an angle measured in radians.
2595
2596 See also @sin().
2597end:
2598
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002599function: native_sin
2600version: UNRELEASED
2601attrib: const
2602w: 1, 2, 3, 4
2603t: f16
2604ret: #2#1
2605arg: #2#1 v
2606test: none
2607end:
2608
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002609function: native_sincos
2610version: 21
2611w: 1, 2, 3, 4
2612t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002613ret: #2#1, "Sine."
2614arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002615arg: #2#1* cos, "*cos will be set to the cosine value."
2616summary: Approximate sine and cosine
2617description:
2618 Returns the approximate sine and cosine of a value.
2619
2620 See also @sincos().
2621# TODO Temporary
2622test: limited(0.0005)
2623end:
2624
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002625function: native_sincos
2626version: UNRELEASED
2627w: 1, 2, 3, 4
2628t: f16
2629ret: #2#1
2630arg: #2#1 v
2631arg: #2#1* cos
2632test: none
2633end:
2634
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002635function: native_sinh
2636version: 21
2637attrib: const
2638w: 1, 2, 3, 4
2639t: f32
2640ret: #2#1
2641arg: #2#1 v
2642summary: Approximate hyperbolic sine
2643description:
2644 Returns the approximate hyperbolic sine of a value specified in radians.
2645
2646 See also @sinh().
2647end:
2648
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002649function: native_sinh
2650version: UNRELEASED
2651attrib: const
2652w: 1, 2, 3, 4
2653t: f16
2654ret: #2#1
2655arg: #2#1 v
2656test: none
2657end:
2658
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002659function: native_sinpi
2660version: 21
2661attrib: const
2662w: 1, 2, 3, 4
2663t: f32
2664ret: #2#1
2665arg: #2#1 v
2666summary: Approximate sine of a number multiplied by pi
2667description:
2668 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2669
2670 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2671
2672 See also @sinpi().
2673end:
2674
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002675function: native_sinpi
2676version: UNRELEASED
2677attrib: const
2678w: 1, 2, 3, 4
2679t: f16
2680ret: #2#1
2681arg: #2#1 v
2682test: none
2683end:
2684
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002685function: native_sqrt
2686version: 21
2687attrib: const
2688w: 1, 2, 3, 4
2689t: f32
2690ret: #2#1
2691arg: #2#1 v
2692summary: Approximate square root
2693description:
2694 Returns the approximate sqrt(v).
2695
2696 See also @sqrt(), @half_sqrt().
2697end:
2698
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002699function: native_sqrt
2700version: UNRELEASED
2701attrib: const
2702w: 1, 2, 3, 4
2703t: f16
2704ret: #2#1
2705arg: #2#1 v
2706test: none
2707end:
2708
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002709function: native_tan
2710version: 21
2711attrib: const
2712w: 1, 2, 3, 4
2713t: f32
2714ret: #2#1
2715arg: #2#1 v
2716summary: Approximate tangent
2717description:
2718 Returns the approximate tangent of an angle measured in radians.
2719end:
2720
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002721function: native_tan
2722version: UNRELEASED
2723attrib: const
2724w: 1, 2, 3, 4
2725t: f16
2726ret: #2#1
2727arg: #2#1 v
2728test: none
2729end:
2730
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002731function: native_tanh
2732version: 21
2733attrib: const
2734w: 1, 2, 3, 4
2735t: f32
2736ret: #2#1
2737arg: #2#1 v
2738summary: Approximate hyperbolic tangent
2739description:
2740 Returns the approximate hyperbolic tangent of a value.
2741
2742 See also @tanh().
2743end:
2744
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002745function: native_tanh
2746version: UNRELEASED
2747attrib: const
2748w: 1, 2, 3, 4
2749t: f16
2750ret: #2#1
2751arg: #2#1 v
2752test: none
2753end:
2754
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002755function: native_tanpi
2756version: 21
2757attrib: const
2758w: 1, 2, 3, 4
2759t: f32
2760ret: #2#1
2761arg: #2#1 v
2762summary: Approximate tangent of a number multiplied by pi
2763description:
2764 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2765
2766 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2767
2768 See also @tanpi().
2769end:
2770
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002771function: native_tanpi
2772version: UNRELEASED
2773attrib: const
2774w: 1, 2, 3, 4
2775t: f16
2776ret: #2#1
2777arg: #2#1 v
2778test: none
2779end:
2780
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002781function: nextafter
2782version: 9
2783attrib: const
2784w: 1, 2, 3, 4
2785t: f32
2786ret: #2#1
2787arg: #2#1 v
2788arg: #2#1 target
2789summary: Next floating point number
2790description:
2791 Returns the next representable floating point number from v towards target.
2792
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002793 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2794 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002795end:
2796
Pirama Arumuga Nainard021b482016-02-04 11:40:05 -08002797function: nextafter
2798version: UNRELEASED
2799attrib: const
2800w: 1, 2, 3, 4
2801t: f16
2802ret: #2#1
2803arg: #2#1 v
2804arg: #2#1 target
2805test: none
2806end:
2807
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002808function: pow
2809version: 9
2810attrib: const
2811w: 1, 2, 3, 4
2812t: f32
2813ret: #2#1
2814arg: #2#1 base
2815arg: #2#1 exponent
2816summary: Base raised to an exponent
2817description:
2818 Returns base raised to the power exponent, i.e. base ^ exponent.
2819
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002820 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2821 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002822end:
2823
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002824function: pow
2825version: UNRELEASED
2826attrib: const
2827w: 1, 2, 3, 4
2828t: f16
2829ret: #2#1
2830arg: #2#1 base
2831arg: #2#1 exponent
2832test: none
2833end:
2834
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002835function: pown
2836version: 9
2837attrib: const
2838w: 1, 2, 3, 4
2839t: f32
2840ret: #2#1
2841arg: #2#1 base
2842arg: int#1 exponent
2843summary: Base raised to an integer exponent
2844description:
2845 Returns base raised to the power exponent, i.e. base ^ exponent.
2846
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002847 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2848 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002849end:
2850
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002851function: pown
2852version: UNRELEASED
2853attrib: const
2854w: 1, 2, 3, 4
2855t: f16
2856ret: #2#1
2857arg: #2#1 base
2858arg: int#1 exponent
2859test: none
2860end:
2861
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002862function: powr
2863version: 9
2864attrib: const
2865w: 1, 2, 3, 4
2866t: f32
2867ret: #2#1
2868arg: #2#1 base, range(0,3000)
2869arg: #2#1 exponent
2870summary: Positive base raised to an exponent
2871description:
2872 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2873
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002874 @pow() and @pown() are similar. They both make no assumptions about the base.
2875 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002876
2877 See also @native_powr().
2878end:
2879
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002880function: powr
2881version: UNRELEASED
2882attrib: const
2883w: 1, 2, 3, 4
2884t: f16
2885ret: #2#1
2886# TODO Need range(0,3000) here similar to the float version?
2887arg: #2#1 base
2888arg: #2#1 exponent
2889test: none
2890end:
2891
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002892function: radians
2893version: 9
2894attrib: const
2895w: 1, 2, 3, 4
2896t: f32
2897ret: #2#1
2898arg: #2#1 v
2899summary: Converts degrees into radians
2900description:
2901 Converts from degrees to radians.
2902end:
2903
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002904function: radians
2905version: UNRELEASED
2906attrib: const
2907w: 1, 2, 3, 4
2908t: f16
2909ret: #2#1
2910arg: #2#1 v
2911test: none
2912end:
2913
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002914function: remainder
2915version: 9
2916attrib: const
2917w: 1, 2, 3, 4
2918t: f32
2919ret: #2#1
2920arg: #2#1 numerator
2921arg: #2#1 denominator
2922summary: Remainder of a division
2923description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002924 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2925 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002926
2927 The function @fmod() is similar but rounds toward the closest interger.
2928 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2929 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2930end:
2931
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002932function: remainder
2933version: UNRELEASED
2934attrib: const
2935w: 1, 2, 3, 4
2936t: f16
2937ret: #2#1
2938arg: #2#1 numerator
2939arg: #2#1 denominator
2940test: none
2941end:
2942
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002943function: remquo
2944version: 9
2945w: 1, 2, 3, 4
2946t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002947ret: #2#1, "Remainder, precise only for the low three bits."
2948arg: #2#1 numerator, "Numerator."
2949arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002950arg: int#1* quotient, "*quotient will be set to the integer quotient."
2951summary: Remainder and quotient of a division
2952description:
2953 Returns the quotient and the remainder of (numerator / denominator).
2954
2955 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2956
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002957 This function is useful for implementing periodic functions. The low three bits of the
2958 quotient gives the quadrant and the remainder the distance within the quadrant.
2959 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2960 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002961
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002962 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2963 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002964test: custom
2965end:
2966
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002967function: remquo
2968version: UNRELEASED
2969w: 1, 2, 3, 4
2970t: f16
2971ret: #2#1
2972arg: #2#1 numerator
2973arg: #2#1 denominator
2974arg: int#1* quotient
2975test: none
2976end:
2977
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002978function: rint
2979version: 9
2980attrib: const
2981w: 1, 2, 3, 4
2982t: f32
2983ret: #2#1
2984arg: #2#1 v
2985summary: Round to even
2986description:
2987 Rounds to the nearest integral value.
2988
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002989 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2990 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2991 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002992
2993 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2994end:
2995
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002996function: rint
2997version: UNRELEASED
2998attrib: const
2999w: 1, 2, 3, 4
3000t: f16
3001ret: #2#1
3002arg: #2#1 v
3003test: none
3004end:
3005
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003006function: rootn
3007version: 9
3008attrib: const
3009w: 1, 2, 3, 4
3010t: f32
3011ret: #2#1
3012arg: #2#1 v
3013arg: int#1 n
3014summary: Nth root
3015description:
3016 Compute the Nth root of a value.
3017
3018 See also @native_rootn().
3019end:
3020
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003021function: rootn
3022version: UNRELEASED
3023attrib: const
3024w: 1, 2, 3, 4
3025t: f16
3026ret: #2#1
3027arg: #2#1 v
3028arg: int#1 n
3029test: none
3030end:
3031
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003032function: round
3033version: 9
3034attrib: const
3035w: 1, 2, 3, 4
3036t: f32
3037ret: #2#1
3038arg: #2#1 v
3039summary: Round away from zero
3040description:
3041 Round to the nearest integral value.
3042
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003043 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
3044 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
3045 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003046
3047 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
3048end:
3049
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003050function: round
3051version: UNRELEASED
3052attrib: const
3053w: 1, 2, 3, 4
3054t: f16
3055ret: #2#1
3056arg: #2#1 v
3057test: none
3058end:
3059
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003060function: rsqrt
3061version: 9
3062attrib: const
3063w: 1, 2, 3, 4
3064t: f32
3065ret: #2#1
3066arg: #2#1 v
3067summary: Reciprocal of a square root
3068description:
3069 Returns (1 / sqrt(v)).
3070
3071 See also @half_rsqrt(), @native_rsqrt().
3072end:
3073
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003074function: rsqrt
3075version: UNRELEASED
3076attrib: const
3077w: 1, 2, 3, 4
3078t: f16
3079ret: #2#1
3080arg: #2#1 v
3081test: none
3082end:
3083
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003084function: sign
3085version: 9
3086attrib: const
3087w: 1, 2, 3, 4
3088t: f32
3089ret: #2#1
3090arg: #2#1 v
3091summary: Sign of a value
3092description:
3093 Returns the sign of a value.
3094
3095 if (v &lt; 0) return -1.f;
3096 else if (v &gt; 0) return 1.f;
3097 else return 0.f;
3098end:
3099
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003100function: sign
3101version:UNRELEASED
3102attrib: const
3103w: 1, 2, 3, 4
3104t: f16
3105ret: #2#1
3106arg: #2#1 v
3107test: none
3108end:
3109
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003110function: sin
3111version: 9
3112attrib: const
3113w: 1, 2, 3, 4
3114t: f32
3115ret: #2#1
3116arg: #2#1 v
3117summary: Sine
3118description:
3119 Returns the sine of an angle measured in radians.
3120
3121 See also @native_sin().
3122end:
3123
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003124function: sin
3125version: UNRELEASED
3126attrib: const
3127w: 1, 2, 3, 4
3128t: f16
3129ret: #2#1
3130arg: #2#1 v
3131test: none
3132end:
3133
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003134function: sincos
3135version: 9
3136w: 1, 2, 3, 4
3137t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003138ret: #2#1, "Sine of v."
3139arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003140arg: #2#1* cos, "*cos will be set to the cosine value."
3141summary: Sine and cosine
3142description:
3143 Returns the sine and cosine of a value.
3144
3145 See also @native_sincos().
3146end:
3147
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003148function: sincos
3149version: UNRELEASED
3150w: 1, 2, 3, 4
3151t: f16
3152ret: #2#1
3153arg: #2#1 v
3154arg: #2#1* cos
3155test: none
3156end:
3157
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003158function: sinh
3159version: 9
3160attrib: const
3161w: 1, 2, 3, 4
3162t: f32
3163ret: #2#1
3164arg: #2#1 v
3165summary: Hyperbolic sine
3166description:
3167 Returns the hyperbolic sine of v, where v is measured in radians.
3168
3169 See also @native_sinh().
3170end:
3171
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003172function: sinh
3173version: UNRELEASED
3174attrib: const
3175w: 1, 2, 3, 4
3176t: f16
3177ret: #2#1
3178arg: #2#1 v
3179test: none
3180end:
3181
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003182function: sinpi
3183version: 9
3184attrib: const
3185w: 1, 2, 3, 4
3186t: f32
3187ret: #2#1
3188arg: #2#1 v
3189summary: Sine of a number multiplied by pi
3190description:
3191 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3192
3193 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3194
3195 See also @native_sinpi().
3196end:
3197
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003198function: sinpi
3199version: UNRELEASED
3200attrib: const
3201w: 1, 2, 3, 4
3202t: f16
3203ret: #2#1
3204arg: #2#1 v
3205test: none
3206end:
3207
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003208function: sqrt
3209version: 9
3210attrib: const
3211w: 1, 2, 3, 4
3212t: f32
3213ret: #2#1
3214arg: #2#1 v
3215summary: Square root
3216description:
3217 Returns the square root of a value.
3218
3219 See also @half_sqrt(), @native_sqrt().
3220end:
3221
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003222function: sqrt
3223version: UNRELEASED
3224attrib: const
3225w: 1, 2, 3, 4
3226t: f16
3227ret: #2#1
3228arg: #2#1 v
3229test: none
3230end:
3231
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003232function: step
3233version: 9
3234attrib: const
3235w: 1, 2, 3, 4
3236t: f32
3237ret: #2#1
3238arg: #2#1 edge
3239arg: #2#1 v
3240summary: 0 if less than a value, 0 otherwise
3241description:
3242 Returns 0.f if v &lt; edge, 1.f otherwise.
3243
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003244 This can be useful to create conditional computations without using loops and branching
3245 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3246 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 -07003247end:
3248
3249function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003250version: UNRELEASED
3251attrib: const
3252w: 1, 2, 3, 4
3253t: f16
3254ret: #2#1
3255arg: #2#1 edge
3256arg: #2#1 v
3257test: none
3258end:
3259
3260function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003261version: 9
3262attrib: const
3263w: 2, 3, 4
3264t: f32
3265ret: #2#1
3266arg: #2#1 edge
3267arg: #2 v
3268end:
3269
3270function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003271version: UNRELEASED
3272attrib: const
3273w: 2, 3, 4
3274t: f16
3275ret: #2#1
3276arg: #2#1 edge
3277arg: #2 v
3278test: none
3279end:
3280
3281function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003282version: 21
3283attrib: const
3284w: 2, 3, 4
3285t: f32
3286ret: #2#1
3287arg: #2 edge
3288arg: #2#1 v
3289end:
3290
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003291function: step
3292version: UNRELEASED
3293attrib: const
3294w: 2, 3, 4
3295t: f16
3296ret: #2#1
3297arg: #2 edge
3298arg: #2#1 v
3299test: none
3300end:
3301
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003302function: tan
3303version: 9
3304attrib: const
3305w: 1, 2, 3, 4
3306t: f32
3307ret: #2#1
3308arg: #2#1 v
3309summary: Tangent
3310description:
3311 Returns the tangent of an angle measured in radians.
3312
3313 See also @native_tan().
3314end:
3315
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003316function: tan
3317version: UNRELEASED
3318attrib: const
3319w: 1, 2, 3, 4
3320t: f16
3321ret: #2#1
3322arg: #2#1 v
3323test: none
3324end:
3325
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003326function: tanh
3327version: 9
3328attrib: const
3329w: 1, 2, 3, 4
3330t: f32
3331ret: #2#1
3332arg: #2#1 v
3333summary: Hyperbolic tangent
3334description:
3335 Returns the hyperbolic tangent of a value.
3336
3337 See also @native_tanh().
3338end:
3339
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003340function: tanh
3341version: UNRELEASED
3342attrib: const
3343w: 1, 2, 3, 4
3344t: f16
3345ret: #2#1
3346arg: #2#1 v
3347test: none
3348end:
3349
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003350function: tanpi
3351version: 9
3352attrib: const
3353w: 1, 2, 3, 4
3354t: f32
3355ret: #2#1
3356arg: #2#1 v
3357summary: Tangent of a number multiplied by pi
3358description:
3359 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3360
3361 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3362
3363 See also @native_tanpi().
3364end:
3365
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003366function: tanpi
3367version: UNRELEASED
3368attrib: const
3369w: 1, 2, 3, 4
3370t: f16
3371ret: #2#1
3372arg: #2#1 v
3373test: none
3374end:
3375
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003376function: tgamma
3377version: 9
3378attrib: const
3379w: 1, 2, 3, 4
3380t: f32
3381ret: #2#1
3382arg: #2#1 v
3383summary: Gamma function
3384description:
3385 Returns the gamma function of a value.
3386
3387 See also @lgamma().
3388end:
3389
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003390function: tgamma
3391version: UNRELEASED
3392attrib: const
3393w: 1, 2, 3, 4
3394t: f16
3395ret: #2#1
3396arg: #2#1 v
3397test: none
3398end:
3399
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003400function: trunc
3401version: 9
3402attrib: const
3403w: 1, 2, 3, 4
3404t: f32
3405ret: #2#1
3406arg: #2#1 v
3407summary: Truncates a floating point
3408description:
3409 Rounds to integral using truncation.
3410
3411 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3412
3413 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003414end:
3415
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003416function: trunc
3417version: UNRELEASED
3418attrib: const
3419w: 1, 2, 3, 4
3420t: f16
3421ret: #2#1
3422arg: #2#1 v
3423test: none
3424end:
3425
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003426function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003427attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003428t: i8, i16, i32, u8, u16, u32
3429ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003430arg: #1 amount, "Value to clamp."
3431arg: #1 low, "Lower bound."
3432arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003433deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003434summary: Restrain a value to a range
3435description:
3436 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003437test: none
3438end:
3439
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003440function: rsFrac
3441attrib: const
3442ret: float
3443arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003444deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003445summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003446description:
3447 Returns the fractional part of a float
3448test: none
3449end:
3450
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003451function: rsRand
3452ret: int
3453arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003454summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003455description:
3456 Return a random value between 0 (or min_value) and max_malue.
3457test: none
3458end:
3459
3460function: rsRand
3461ret: int
3462arg: int min_value
3463arg: int max_value
3464test: none
3465end:
3466
3467function: rsRand
3468ret: float
3469arg: float max_value
3470test: none
3471end:
3472
3473function: rsRand
3474ret: float
3475arg: float min_value
3476arg: float max_value
3477test: none
3478end: