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