blob: f686bab20ad88b4bbc42d7087d9a06d0b6188793 [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
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800583# TODO add f16 copysign
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700584function: copysign
585version: 9
586attrib: const
587w: 1, 2, 3, 4
588t: f32
589ret: #2#1
590arg: #2#1 magnitude_value
591arg: #2#1 sign_value
592summary: Copies the sign of a number to another
593description:
594 Copies the sign from sign_value to magnitude_value.
595
596 The value returned is either magnitude_value or -magnitude_value.
597
598 For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
599end:
600
601function: cos
602version: 9
603attrib: const
604w: 1, 2, 3, 4
605t: f32
606ret: #2#1
607arg: #2#1 v
608summary: Cosine
609description:
610 Returns the cosine of an angle measured in radians.
611
612 See also @native_cos().
613end:
614
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800615function: cos
616version: UNRELEASED
617attrib: const
618w: 1, 2, 3, 4
619t: f16
620ret: #2#1
621arg: #2#1 v
622test: none
623end:
624
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700625function: cosh
626version: 9
627attrib: const
628w: 1, 2, 3, 4
629t: f32
630ret: #2#1
631arg: #2#1 v
632summary: Hypebolic cosine
633description:
634 Returns the hypebolic cosine of v, where v is measured in radians.
635
636 See also @native_cosh().
637end:
638
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800639function: cosh
640version: UNRELEASED
641attrib: const
642w: 1, 2, 3, 4
643t: f16
644ret: #2#1
645arg: #2#1 v
646test: none
647end:
648
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700649function: cospi
650version: 9
651attrib: const
652w: 1, 2, 3, 4
653t: f32
654ret: #2#1
655arg: #2#1 v
656summary: Cosine of a number multiplied by pi
657description:
658 Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
659
660 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
661
662 See also @native_cospi().
663end:
664
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800665function: cospi
666version: UNRELEASED
667attrib: const
668w: 1, 2, 3, 4
669t: f16
670ret: #2#1
671arg: #2#1 v
672test: none
673end:
674
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700675function: degrees
676version: 9
677attrib: const
678w: 1, 2, 3, 4
679t: f32
680ret: #2#1
681arg: #2#1 v
682summary: Converts radians into degrees
683description:
684 Converts from radians to degrees.
685end:
686
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800687function: degrees
688version: UNRELEASED
689attrib: const
690w: 1, 2, 3, 4
691t: f16
692ret: #2#1
693arg: #2#1 v
694test: none
695end:
696
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700697function: erf
698version: 9
699attrib: const
700w: 1, 2, 3, 4
701t: f32
702ret: #2#1
703arg: #2#1 v
704summary: Mathematical error function
705description:
706 Returns the error function.
707end:
708
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800709function: erf
710version: UNRELEASED
711attrib: const
712w: 1, 2, 3, 4
713t: f16
714ret: #2#1
715arg: #2#1 v
716test: none
717end:
718
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700719function: erfc
720version: 9
721attrib: const
722w: 1, 2, 3, 4
723t: f32
724ret: #2#1
725arg: #2#1 v
726summary: Mathematical complementary error function
727description:
728 Returns the complementary error function.
729end:
730
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800731function: erfc
732version: UNRELEASED
733attrib: const
734w: 1, 2, 3, 4
735t: f16
736ret: #2#1
737arg: #2#1 v
738test: none
739end:
740
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700741function: exp
742version: 9
743attrib: const
744w: 1, 2, 3, 4
745t: f32
746ret: #2#1
747arg: #2#1 v
748summary: e raised to a number
749description:
750 Returns e raised to v, i.e. e ^ v.
751
752 See also @native_exp().
753end:
754
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800755function: exp
756version: UNRELEASED
757attrib: const
758w: 1, 2, 3, 4
759t: f16
760ret: #2#1
761arg: #2#1 v
762test: none
763end:
764
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700765function: exp10
766version: 9
767attrib: const
768w: 1, 2, 3, 4
769t: f32
770ret: #2#1
771arg: #2#1 v
772summary: 10 raised to a number
773description:
774 Returns 10 raised to v, i.e. 10.f ^ v.
775
776 See also @native_exp10().
777end:
778
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800779function: exp10
780version: UNRELEASED
781attrib: const
782w: 1, 2, 3, 4
783t: f16
784ret: #2#1
785arg: #2#1 v
786test: none
787end:
788
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700789function: exp2
790version: 9
791attrib: const
792w: 1, 2, 3, 4
793t: f32
794ret: #2#1
795arg: #2#1 v
796summary: 2 raised to a number
797description:
798 Returns 2 raised to v, i.e. 2.f ^ v.
799
800 See also @native_exp2().
801end:
802
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800803function: exp2
804version: UNRELEASED
805attrib: const
806w: 1, 2, 3, 4
807t: f16
808ret: #2#1
809arg: #2#1 v
810test: none
811end:
812
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700813function: expm1
814version: 9
815attrib: const
816w: 1, 2, 3, 4
817t: f32
818ret: #2#1
819arg: #2#1 v
820summary: e raised to a number minus one
821description:
822 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
823
824 See also @native_expm1().
825end:
826
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800827function: expm1
828version: UNRELEASED
829attrib: const
830w: 1, 2, 3, 4
831t: f16
832ret: #2#1
833arg: #2#1 v
834test: none
835end:
836
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700837function: fabs
838version: 9
839attrib: const
840w: 1, 2, 3, 4
841t: f32
842ret: #2#1
843arg: #2#1 v
844summary: Absolute value of a float
845description:
846 Returns the absolute value of the float v.
847
848 For integers, use @abs().
849end:
850
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800851function: fabs
852version: UNRELEASED
853attrib: const
854w: 1, 2, 3, 4
855t: f16
856ret: #2#1
857arg: #2#1 v
858test: none
859end:
860
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700861function: fdim
862version: 9
863attrib: const
864w: 1, 2, 3, 4
865t: f32
866ret: #2#1
867arg: #2#1 a
868arg: #2#1 b
869summary: Positive difference between two values
870description:
871 Returns the positive difference between two values.
872
873 If a &gt; b, returns (a - b) otherwise returns 0f.
874end:
875
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800876function: fdim
877version: UNRELEASED
878attrib: const
879w: 1, 2, 3, 4
880t: f16
881ret: #2#1
882arg: #2#1 a
883arg: #2#1 b
884test: none
885end:
886
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700887function: floor
888version: 9
889attrib: const
890w: 1, 2, 3, 4
891t: f32
892ret: #2#1
893arg: #2#1 v
894summary: Smallest integer not greater than a value
895description:
896 Returns the smallest integer not greater than a value.
897
898 For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
899
900 See also @ceil().
901end:
902
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800903function: floor
904version: UNRELEASED
905attrib: const
906w: 1, 2, 3, 4
907t: f16
908ret: #2#1
909arg: #2#1 v
910test: none
911end:
912
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700913function: fma
914version: 9
915attrib: const
916w: 1, 2, 3, 4
917t: f32
918ret: #2#1
919arg: #2#1 multiplicand1
920arg: #2#1 multiplicand2
921arg: #2#1 offset
922summary: Multiply and add
923description:
924 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
925
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -0700926 This function is similar to @mad(). fma() retains full precision of the multiplied result
927 and rounds only after the addition. @mad() rounds after the multiplication and the addition.
928 This extra precision is not guaranteed in rs_fp_relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700929end:
930
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800931function: fma
932version: UNRELEASED
933attrib: const
934w: 1, 2, 3, 4
935t: f16
936ret: #2#1
937arg: #2#1 multiplicand1
938arg: #2#1 multiplicand2
939arg: #2#1 offset
940test: none
941end:
942
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700943function: fmax
944version: 9
945attrib: const
946w: 1, 2, 3, 4
947t: f32
948ret: #2#1
949arg: #2#1 a
950arg: #2#1 b
951summary: Maximum of two floats
952description:
953 Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
954
955 The @max() function returns identical results but can be applied to more data types.
956end:
957
958function: fmax
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800959version: UNRELEASED
960attrib: const
961w: 1, 2, 3, 4
962t: f16
963ret: #2#1
964arg: #2#1 a
965arg: #2#1 b
966test: none
967end:
968
969function: fmax
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700970version: 9
971attrib: const
972w: 2, 3, 4
973t: f32
974ret: #2#1
975arg: #2#1 a
976arg: #2 b
977end:
978
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -0800979function: fmax
980version: UNRELEASED
981attrib: const
982w: 2, 3, 4
983t: f16
984ret: #2#1
985arg: #2#1 a
986arg: #2 b
987test: none
988end:
989
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -0700990function: fmin
991version: 9
992attrib: const
993w: 1, 2, 3, 4
994t: f32
995ret: #2#1
996arg: #2#1 a
997arg: #2#1 b
998summary: Minimum of two floats
999description:
1000 Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
1001
1002 The @min() function returns identical results but can be applied to more data types.
1003end:
1004
1005function: fmin
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001006version: UNRELEASED
1007attrib: const
1008w: 1, 2, 3, 4
1009t: f16
1010ret: #2#1
1011arg: #2#1 a
1012arg: #2#1 b
1013test: none
1014end:
1015
1016function: fmin
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001017version: 9
1018attrib: const
1019w: 2, 3, 4
1020t: f32
1021ret: #2#1
1022arg: #2#1 a
1023arg: #2 b
1024end:
1025
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001026function: fmin
1027version: UNRELEASED
1028attrib: const
1029w: 2, 3, 4
1030t: f16
1031ret: #2#1
1032arg: #2#1 a
1033arg: #2 b
1034test: none
1035end:
1036
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001037function: fmod
1038version: 9
1039attrib: const
1040w: 1, 2, 3, 4
1041t: f32
1042ret: #2#1
1043arg: #2#1 numerator
1044arg: #2#1 denominator
1045summary: Modulo
1046description:
1047 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
1048
1049 The function @remainder() is similar but rounds toward the closest interger.
1050 For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
1051 while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
1052end:
1053
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001054function: fmod
1055version: UNRELEASED
1056attrib: const
1057w: 1, 2, 3, 4
1058t: f16
1059ret: #2#1
1060arg: #2#1 numerator
1061arg: #2#1 denominator
1062test: none
1063end:
1064
1065# TODO Add (both variants) of fract for f16
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001066function: fract
1067version: 9
1068w: 1, 2, 3, 4
1069t: f32
1070ret: #2#1
1071arg: #2#1 v, "Input value."
1072arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
1073summary: Positive fractional part
1074description:
1075 Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
1076
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001077 For example, <code>fract(1.3f, &amp;val)</code> returns 0.3f and sets val to 1.f.
1078 <code>fract(-1.3f, &amp;val)</code> returns 0.7f and sets val to -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001079end:
1080
1081function: fract
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001082version: 9 23
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001083attrib: const
1084w: 1, 2, 3, 4
1085t: f32
1086ret: #2#1
1087arg: #2#1 v
1088inline:
1089 #2#1 unused;
1090 return fract(v, &unused);
1091end:
1092
Verena Beckham9cbc99b2015-11-16 12:25:54 +00001093function: fract
1094version: 24
1095w: 1, 2, 3, 4
1096t: f32
1097ret: #2#1
1098arg: #2#1 v
1099end:
1100
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001101# TODO Add f16 frexp
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001102function: frexp
1103version: 9
1104w: 1, 2, 3, 4
1105t: f32
1106ret: #2#1
1107arg: #2#1 v, "Input value."
1108arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1109summary: Binary mantissa and exponent
1110description:
1111 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1112
1113 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1114
1115 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1116end:
1117
1118function: half_recip
1119version: 17
1120attrib: const
1121w: 1, 2, 3, 4
1122t: f32
1123ret: #2#1
1124arg: #2#1 v
1125summary: Reciprocal computed to 16 bit precision
1126description:
1127 Returns the approximate reciprocal of a value.
1128
1129 The precision is that of a 16 bit floating point value.
1130
1131 See also @native_recip().
1132end:
1133
1134function: half_rsqrt
1135version: 17
1136attrib: const
1137w: 1, 2, 3, 4
1138t: f32
1139ret: #2#1
1140arg: #2#1 v
1141summary: Reciprocal of a square root computed to 16 bit precision
1142description:
1143 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1144
1145 The precision is that of a 16 bit floating point value.
1146
1147 See also @rsqrt(), @native_rsqrt().
1148end:
1149
1150function: half_sqrt
1151version: 17
1152attrib: const
1153w: 1, 2, 3, 4
1154t: f32
1155ret: #2#1
1156arg: #2#1 v
1157summary: Square root computed to 16 bit precision
1158description:
1159 Returns the approximate square root of a value.
1160
1161 The precision is that of a 16 bit floating point value.
1162
1163 See also @sqrt(), @native_sqrt().
1164end:
1165
1166function: hypot
1167version: 9
1168attrib: const
1169w: 1, 2, 3, 4
1170t: f32
1171ret: #2#1
1172arg: #2#1 a
1173arg: #2#1 b
1174summary: Hypotenuse
1175description:
1176 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1177
1178 See also @native_hypot().
1179end:
1180
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001181function: hypot
1182version: UNRELEASED
1183attrib: const
1184w: 1, 2, 3, 4
1185t: f16
1186ret: #2#1
1187arg: #2#1 a
1188arg: #2#1 b
1189test: none
1190end:
1191
1192# TODO Add f16 ilogb. Should its return be short?
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001193function: ilogb
1194version: 9
1195attrib: const
1196w: 1, 2, 3, 4
1197t: f32
1198ret: int#1
1199arg: float#1 v
1200summary: Base two exponent
1201description:
1202 Returns the base two exponent of a value, where the mantissa is between
1203 1.f (inclusive) and 2.f (exclusive).
1204
1205 For example, <code>ilogb(8.5f)</code> returns 3.
1206
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001207 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001208
1209 @logb() is similar but returns a float.
1210test: custom
1211end:
1212
1213function: ldexp
1214version: 9
1215attrib: const
1216w: 1, 2, 3, 4
1217ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001218arg: float#1 mantissa, "Mantissa."
1219arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001220summary: Creates a floating point from mantissa and exponent
1221description:
1222 Returns the floating point created from the mantissa and exponent,
1223 i.e. (mantissa * 2 ^ exponent).
1224
1225 See @frexp() for the reverse operation.
1226end:
1227
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001228# TODO Should this parameter be a short?
1229function: ldexp
1230version: UNRELEASED
1231attrib: const
1232w: 1, 2, 3, 4
1233ret: half#1
1234arg: half#1 mantissa
1235arg: int#1 exponent
1236test: none
1237end:
1238
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001239function: ldexp
1240version: 9
1241attrib: const
1242w: 2, 3, 4
1243ret: float#1
1244arg: float#1 mantissa
1245arg: int exponent
1246end:
1247
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001248function: ldexp
1249version: UNRELEASED
1250attrib: const
1251w: 2, 3, 4
1252ret: half#1
1253arg: half#1 mantissa
1254arg: int exponent
1255test: none
1256end:
1257
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001258function: lgamma
1259version: 9
1260attrib: const
1261w: 1, 2, 3, 4
1262t: f32
1263ret: #2#1
1264arg: #2#1 v
1265summary: Natural logarithm of the gamma function
1266description:
1267 Returns the natural logarithm of the absolute value of the gamma function,
1268 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1269
1270 See also @tgamma().
1271end:
1272
1273function: lgamma
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001274version: UNRELEASED
1275attrib: const
1276w: 1, 2, 3, 4
1277t: f16
1278ret: #2#1
1279arg: #2#1 v
1280test: none
1281end:
1282
1283function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001284version: 9
1285w: 1, 2, 3, 4
1286t: f32
1287ret: #2#1
1288arg: #2#1 v
1289arg: 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."
1290test: custom
1291#TODO Temporary until bionic & associated drivers are fixed
1292end:
1293
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001294function: lgamma
1295version: UNRELEASED
1296w: 1, 2, 3, 4
1297t: f16
1298ret: #2#1
1299arg: #2#1 v
1300arg: int#1* sign_of_gamma
1301test: none
1302end:
1303
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001304function: log
1305version: 9
1306attrib: const
1307w: 1, 2, 3, 4
1308t: f32
1309ret: #2#1
1310arg: #2#1 v
1311summary: Natural logarithm
1312description:
1313 Returns the natural logarithm.
1314
1315 See also @native_log().
1316end:
1317
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001318function: log
1319version: UNRELEASED
1320attrib: const
1321w: 1, 2, 3, 4
1322t: f16
1323ret: #2#1
1324arg: #2#1 v
1325test: none
1326end:
1327
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001328function: log10
1329version: 9
1330attrib: const
1331w: 1, 2, 3, 4
1332t: f32
1333ret: #2#1
1334arg: #2#1 v
1335summary: Base 10 logarithm
1336description:
1337 Returns the base 10 logarithm.
1338
1339 See also @native_log10().
1340end:
1341
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001342function: log10
1343version: UNRELEASED
1344attrib: const
1345w: 1, 2, 3, 4
1346t: f16
1347ret: #2#1
1348arg: #2#1 v
1349test: none
1350end:
1351
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001352function: log1p
1353version: 9
1354attrib: const
1355w: 1, 2, 3, 4
1356t: f32
1357ret: #2#1
1358arg: #2#1 v
1359summary: Natural logarithm of a value plus 1
1360description:
1361 Returns the natural logarithm of <code>(v + 1.f)</code>.
1362
1363 See also @native_log1p().
1364end:
1365
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001366function: log1p
1367version: UNRELEASED
1368attrib: const
1369w: 1, 2, 3, 4
1370t: f16
1371ret: #2#1
1372arg: #2#1 v
1373test: none
1374end:
1375
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001376function: log2
1377version: 9
1378attrib: const
1379w: 1, 2, 3, 4
1380t: f32
1381ret: #2#1
1382arg: #2#1 v
1383summary: Base 2 logarithm
1384description:
1385 Returns the base 2 logarithm.
1386
1387 See also @native_log2().
1388end:
1389
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001390function: log2
1391version: UNRELEASED
1392attrib: const
1393w: 1, 2, 3, 4
1394t: f16
1395ret: #2#1
1396arg: #2#1 v
1397test: none
1398end:
1399
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001400function: logb
1401version: 9
1402attrib: const
1403w: 1, 2, 3, 4
1404t: f32
1405ret: #2#1
1406arg: #2#1 v
1407summary: Base two exponent
1408description:
1409 Returns the base two exponent of a value, where the mantissa is between
1410 1.f (inclusive) and 2.f (exclusive).
1411
1412 For example, <code>logb(8.5f)</code> returns 3.f.
1413
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001414 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001415
1416 @ilogb() is similar but returns an integer.
1417end:
1418
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001419function: logb
1420version: UNRELEASED
1421attrib: const
1422w: 1, 2, 3, 4
1423t: f16
1424ret: #2#1
1425arg: #2#1 v
1426test: none
1427end:
1428
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001429function: mad
1430version: 9
1431attrib: const
1432w: 1, 2, 3, 4
1433t: f32
1434ret: #2#1
1435arg: #2#1 multiplicand1
1436arg: #2#1 multiplicand2
1437arg: #2#1 offset
1438summary: Multiply and add
1439description:
1440 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1441
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001442 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1443 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1444 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001445end:
1446
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001447function: mad
1448version: UNRELEASED
1449attrib: const
1450w: 1, 2, 3, 4
1451t: f16
1452ret: #2#1
1453arg: #2#1 multiplicand1
1454arg: #2#1 multiplicand2
1455arg: #2#1 offset
1456test: none
1457end:
1458
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001459function: max
1460version: 9
1461attrib: const
1462w: 1, 2, 3, 4
1463t: f32
1464ret: #2#1
1465arg: #2#1 a
1466arg: #2#1 b
1467summary: Maximum
1468description:
1469 Returns the maximum value of two arguments.
1470end:
1471
1472function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001473version:UNRELEASED
1474attrib: const
1475w: 1, 2, 3, 4
1476t: f16
1477ret: #2#1
1478arg: #2#1 a
1479arg: #2#1 b
1480test: none
1481end:
1482
1483function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001484version: 9
1485attrib: const
1486w: 2, 3, 4
1487t: f32
1488ret: #2#1
1489arg: #2#1 a
1490arg: #2 b
1491end:
1492
1493function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001494version: UNRELEASED
1495attrib: const
1496w: 2, 3, 4
1497t: f16
1498ret: #2#1
1499arg: #2#1 a
1500arg: #2 b
1501test: none
1502end:
1503
1504function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001505version: 9 20
1506attrib: const
1507w: 1
1508t: i8, i16, i32, u8, u16, u32
1509ret: #2#1
1510arg: #2#1 a
1511arg: #2#1 b
1512inline:
1513 return (a > b ? a : b);
1514end:
1515
1516function: max
1517version: 9 20
1518attrib: const
1519w: 2
1520t: i8, i16, i32, u8, u16, u32
1521ret: #2#1
1522arg: #2#1 a
1523arg: #2#1 b
1524inline:
1525 #2#1 tmp;
1526 tmp.x = (a.x > b.x ? a.x : b.x);
1527 tmp.y = (a.y > b.y ? a.y : b.y);
1528 return tmp;
1529end:
1530
1531function: max
1532version: 9 20
1533attrib: const
1534w: 3
1535t: i8, i16, i32, u8, u16, u32
1536ret: #2#1
1537arg: #2#1 a
1538arg: #2#1 b
1539inline:
1540 #2#1 tmp;
1541 tmp.x = (a.x > b.x ? a.x : b.x);
1542 tmp.y = (a.y > b.y ? a.y : b.y);
1543 tmp.z = (a.z > b.z ? a.z : b.z);
1544 return tmp;
1545end:
1546
1547function: max
1548version: 9 20
1549attrib: const
1550w: 4
1551t: i8, i16, i32, u8, u16, u32
1552ret: #2#1
1553arg: #2#1 a
1554arg: #2#1 b
1555inline:
1556 #2#1 tmp;
1557 tmp.x = (a.x > b.x ? a.x : b.x);
1558 tmp.y = (a.y > b.y ? a.y : b.y);
1559 tmp.z = (a.z > b.z ? a.z : b.z);
1560 tmp.w = (a.w > b.w ? a.w : b.w);
1561 return tmp;
1562end:
1563
1564function: max
1565version: 21
1566attrib: const
1567w: 1, 2, 3, 4
1568t: i8, i16, i32, i64, u8, u16, u32, u64
1569ret: #2#1
1570arg: #2#1 a
1571arg: #2#1 b
1572end:
1573
1574function: min
1575version: 9
1576attrib: const
1577w: 1, 2, 3, 4
1578t: f32
1579ret: #2#1
1580arg: #2#1 a
1581arg: #2#1 b
1582summary: Minimum
1583description:
1584 Returns the minimum value of two arguments.
1585end:
1586
1587function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001588version: UNRELEASED
1589attrib: const
1590w: 1, 2, 3, 4
1591t: f16
1592ret: #2#1
1593arg: #2#1 a
1594arg: #2#1 b
1595test: none
1596end:
1597
1598function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001599version: 9
1600attrib: const
1601w: 2, 3, 4
1602t: f32
1603ret: #2#1
1604arg: #2#1 a
1605arg: #2 b
1606end:
1607
1608function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001609version: UNRELEASED
1610attrib: const
1611w: 2, 3, 4
1612t: f16
1613ret: #2#1
1614arg: #2#1 a
1615arg: #2 b
1616test: none
1617end:
1618
1619function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001620version: 9 20
1621attrib: const
1622w: 1
1623t: i8, i16, i32, u8, u16, u32
1624ret: #2#1
1625arg: #2#1 a
1626arg: #2#1 b
1627inline:
1628 return (a < b ? a : b);
1629end:
1630
1631function: min
1632version: 9 20
1633attrib: const
1634w: 2
1635t: i8, i16, i32, u8, u16, u32
1636ret: #2#1
1637arg: #2#1 a
1638arg: #2#1 b
1639inline:
1640 #2#1 tmp;
1641 tmp.x = (a.x < b.x ? a.x : b.x);
1642 tmp.y = (a.y < b.y ? a.y : b.y);
1643 return tmp;
1644end:
1645
1646function: min
1647version: 9 20
1648attrib: const
1649w: 3
1650t: i8, i16, i32, u8, u16, u32
1651ret: #2#1
1652arg: #2#1 a
1653arg: #2#1 b
1654inline:
1655 #2#1 tmp;
1656 tmp.x = (a.x < b.x ? a.x : b.x);
1657 tmp.y = (a.y < b.y ? a.y : b.y);
1658 tmp.z = (a.z < b.z ? a.z : b.z);
1659 return tmp;
1660end:
1661
1662function: min
1663version: 9 20
1664attrib: const
1665w: 4
1666t: i8, i16, i32, u8, u16, u32
1667ret: #2#1
1668arg: #2#1 a
1669arg: #2#1 b
1670inline:
1671 #2#1 tmp;
1672 tmp.x = (a.x < b.x ? a.x : b.x);
1673 tmp.y = (a.y < b.y ? a.y : b.y);
1674 tmp.z = (a.z < b.z ? a.z : b.z);
1675 tmp.w = (a.w < b.w ? a.w : b.w);
1676 return tmp;
1677end:
1678
1679function: min
1680version: 21
1681attrib: const
1682w: 1, 2, 3, 4
1683t: i8, i16, i32, i64, u8, u16, u32, u64
1684ret: #2#1
1685arg: #2#1 a
1686arg: #2#1 b
1687end:
1688
1689function: mix
1690version: 9
1691attrib: const
1692w: 1, 2, 3, 4
1693t: f32
1694ret: #2#1
1695arg: #2#1 start
1696arg: #2#1 stop
1697arg: #2#1 fraction
1698summary: Mixes two values
1699description:
1700 Returns start + ((stop - start) * fraction).
1701
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001702 This can be useful for mixing two values. For example, to create a new color that is
1703 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001704end:
1705
1706function: mix
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001707version: UNRELEASED
1708attrib: const
1709w: 1, 2, 3, 4
1710t: f16
1711ret: #2#1
1712arg: #2#1 start
1713arg: #2#1 stop
1714arg: #2#1 fraction
1715test: none
1716end:
1717
1718function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001719version: 9
1720attrib: const
1721w: 2, 3, 4
1722t: f32
1723ret: #2#1
1724arg: #2#1 start
1725arg: #2#1 stop
1726arg: #2 fraction
1727end:
1728
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001729function: mix
1730version: UNRELEASED
1731attrib: const
1732w: 2, 3, 4
1733t: f16
1734ret: #2#1
1735arg: #2#1 start
1736arg: #2#1 stop
1737arg: #2 fraction
1738test: none
1739end:
1740
1741# TODO Add f16 modf
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001742function: modf
1743version: 9
1744w: 1, 2, 3, 4
1745t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001746ret: #2#1, "Floating point portion of the value."
1747arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001748arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1749summary: Integral and fractional components
1750description:
1751 Returns the integral and fractional components of a number.
1752
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001753 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 -08001754 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001755end:
1756
1757function: nan
1758version: 9
1759attrib: const
1760w: 1
1761t: f32
1762ret: #2#1
1763arg: uint#1 v, "Not used."
1764#TODO We're not using the argument. Once we do, add this documentation line:
1765# The argument is embedded into the return value and can be used to distinguish various NaNs.
1766summary: Not a Number
1767description:
1768 Returns a NaN value (Not a Number).
1769end:
1770
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001771function: nan_half
1772version: UNRELEASED
1773attrib: const
1774t: f16
1775ret: #1
1776summary: Not a Number
1777description:
1778 Returns a half-precision floating point NaN value (Not a Number).
1779test: none
1780end:
1781
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001782function: native_acos
1783version: 21
1784attrib: const
1785w: 1, 2, 3, 4
1786t: f32
1787ret: #2#1
1788arg: #2#1 v, range(-1,1)
1789summary: Approximate inverse cosine
1790description:
1791 Returns the approximate inverse cosine, in radians.
1792
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001793 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001794
1795 See also @acos().
1796# TODO Temporary
1797test: limited(0.0005)
1798end:
1799
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001800function: native_acos
1801version: UNRELEASED
1802attrib: const
1803w: 1, 2, 3, 4
1804t: f16
1805ret: #2#1
1806# TODO Need range(-1,1) here similar to the float version?
1807arg: #2#1 v
1808test: none
1809end:
1810
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001811function: native_acosh
1812version: 21
1813attrib: const
1814w: 1, 2, 3, 4
1815t: f32
1816ret: #2#1
1817arg: #2#1 v
1818summary: Approximate inverse hyperbolic cosine
1819description:
1820 Returns the approximate inverse hyperbolic cosine, in radians.
1821
1822 See also @acosh().
1823# TODO Temporary
1824test: limited(0.0005)
1825end:
1826
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001827function: native_acosh
1828version: UNRELEASED
1829attrib: const
1830w: 1, 2, 3, 4
1831t: f16
1832ret: #2#1
1833arg: #2#1 v
1834test: none
1835end:
1836
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001837function: native_acospi
1838version: 21
1839attrib: const
1840w: 1, 2, 3, 4
1841t: f32
1842ret: #2#1
1843arg: #2#1 v, range(-1,1)
1844summary: Approximate inverse cosine divided by pi
1845description:
1846 Returns the approximate inverse cosine in radians, divided by pi.
1847
1848 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1849
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001850 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001851
1852 See also @acospi().
1853# TODO Temporary
1854test: limited(0.0005)
1855end:
1856
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001857function: native_acospi
1858version: UNRELEASED
1859attrib: const
1860w: 1, 2, 3, 4
1861t: f16
1862ret: #2#1
1863# TODO Need range(-1,1) here similar to the float version?
1864arg: #2#1 v
1865test: none
1866end:
1867
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001868function: native_asin
1869version: 21
1870attrib: const
1871w: 1, 2, 3, 4
1872t: f32
1873ret: #2#1
1874arg: #2#1 v, range(-1,1)
1875summary: Approximate inverse sine
1876description:
1877 Returns the approximate inverse sine, in radians.
1878
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001879 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001880
1881 See also @asin().
1882# TODO Temporary
1883test: limited(0.0005)
1884end:
1885
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001886function: native_asin
1887version: UNRELEASED
1888attrib: const
1889w: 1, 2, 3, 4
1890t: f16
1891ret: #2#1
1892# TODO Need range(-1,1) here similar to the float version?
1893arg: #2#1 v
1894test: none
1895end:
1896
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001897function: native_asinh
1898version: 21
1899attrib: const
1900w: 1, 2, 3, 4
1901t: f32
1902ret: #2#1
1903arg: #2#1 v
1904summary: Approximate inverse hyperbolic sine
1905description:
1906 Returns the approximate inverse hyperbolic sine, in radians.
1907
1908 See also @asinh().
1909# TODO Temporary
1910test: limited(0.0005)
1911end:
1912
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001913function: native_asinh
1914version: UNRELEASED
1915attrib: const
1916w: 1, 2, 3, 4
1917t: f16
1918ret: #2#1
1919arg: #2#1 v
1920test: none
1921end:
1922
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001923function: native_asinpi
1924version: 21
1925attrib: const
1926w: 1, 2, 3, 4
1927t: f32
1928ret: #2#1
1929arg: #2#1 v, range(-1,1)
1930summary: Approximate inverse sine divided by pi
1931description:
1932 Returns the approximate inverse sine in radians, divided by pi.
1933
1934 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1935
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001936 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001937
1938 See also @asinpi().
1939# TODO Temporary
1940test: limited(0.0005)
1941end:
1942
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001943function: native_asinpi
1944version: UNRELEASED
1945attrib: const
1946w: 1, 2, 3, 4
1947t: f16
1948ret: #2#1
1949# TODO Need range(-1,1) here similar to the float version?
1950arg: #2#1 v
1951test: none
1952end:
1953
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001954function: native_atan
1955version: 21
1956attrib: const
1957w: 1, 2, 3, 4
1958t: f32
1959ret: #2#1
1960arg: #2#1 v, range(-1,1)
1961summary: Approximate inverse tangent
1962description:
1963 Returns the approximate inverse tangent, in radians.
1964
1965 See also @atan().
1966# TODO Temporary
1967test: limited(0.0005)
1968end:
1969
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001970function: native_atan
1971version: UNRELEASED
1972attrib: const
1973w: 1, 2, 3, 4
1974t: f16
1975ret: #2#1
1976# TODO Need range(-1,1) here similar to the float version?
1977arg: #2#1 v
1978test: none
1979end:
1980
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001981function: native_atan2
1982version: 21
1983attrib: const
1984w: 1, 2, 3, 4
1985t: f32
1986ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001987arg: #2#1 numerator, "Numerator."
1988arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001989summary: Approximate inverse tangent of a ratio
1990description:
1991 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
1992
1993 See also @atan2().
1994# TODO Temporary
1995test: limited(0.0005)
1996end:
1997
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001998function: native_atan2
1999version: UNRELEASED
2000attrib: const
2001w: 1, 2, 3, 4
2002t: f16
2003ret: #2#1
2004arg: #2#1 numerator
2005arg: #2#1 denominator
2006test: none
2007end:
2008
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002009function: native_atan2pi
2010version: 21
2011attrib: const
2012w: 1, 2, 3, 4
2013t: f32
2014ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002015arg: #2#1 numerator, "Numerator."
2016arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002017summary: Approximate inverse tangent of a ratio, divided by pi
2018description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002019 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2020 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002021
2022 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2023
2024 See also @atan2pi().
2025# TODO Temporary
2026test: limited(0.0005)
2027end:
2028
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002029function: native_atan2pi
2030version: UNRELEASED
2031attrib: const
2032w: 1, 2, 3, 4
2033t: f16
2034ret: #2#1
2035arg: #2#1 numerator
2036arg: #2#1 denominator
2037test: none
2038end:
2039
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002040function: native_atanh
2041version: 21
2042attrib: const
2043w: 1, 2, 3, 4
2044t: f32
2045ret: #2#1
2046arg: #2#1 v, range(-1,1)
2047summary: Approximate inverse hyperbolic tangent
2048description:
2049 Returns the approximate inverse hyperbolic tangent, in radians.
2050
2051 See also @atanh().
2052# TODO Temporary
2053test: limited(0.0005)
2054end:
2055
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002056function: native_atanh
2057version: UNRELEASED
2058attrib: const
2059w: 1, 2, 3, 4
2060t: f16
2061ret: #2#1
2062# TODO Need range(-1,1) here similar to the float version?
2063arg: #2#1 v
2064test: none
2065end:
2066
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002067function: native_atanpi
2068version: 21
2069attrib: const
2070w: 1, 2, 3, 4
2071t: f32
2072ret: #2#1
2073arg: #2#1 v, range(-1,1)
2074summary: Approximate inverse tangent divided by pi
2075description:
2076 Returns the approximate inverse tangent in radians, divided by pi.
2077
2078 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2079
2080 See also @atanpi().
2081# TODO Temporary
2082test: limited(0.0005)
2083end:
2084
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002085function: native_atanpi
2086version: UNRELEASED
2087attrib: const
2088w: 1, 2, 3, 4
2089t: f16
2090ret: #2#1
2091# TODO Need range(-1,1) here similar to the float version?
2092arg: #2#1 v
2093test: none
2094end:
2095
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002096function: native_cbrt
2097version: 21
2098attrib: const
2099w: 1, 2, 3, 4
2100t: f32
2101ret: #2#1
2102arg: #2#1 v
2103summary: Approximate cube root
2104description:
2105 Returns the approximate cubic root.
2106
2107 See also @cbrt().
2108end:
2109
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002110function: native_cbrt
2111version: UNRELEASED
2112attrib: const
2113w: 1, 2, 3, 4
2114t: f16
2115ret: #2#1
2116arg: #2#1 v
2117test: none
2118end:
2119
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002120function: native_cos
2121version: 21
2122attrib: const
2123w: 1, 2, 3, 4
2124t: f32
2125ret: #2#1
2126arg: #2#1 v
2127summary: Approximate cosine
2128description:
2129 Returns the approximate cosine of an angle measured in radians.
2130
2131 See also @cos().
2132end:
2133
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002134function: native_cos
2135version: UNRELEASED
2136attrib: const
2137w: 1, 2, 3, 4
2138t: f16
2139ret: #2#1
2140arg: #2#1 v
2141test: none
2142end:
2143
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002144function: native_cosh
2145version: 21
2146attrib: const
2147w: 1, 2, 3, 4
2148t: f32
2149ret: #2#1
2150arg: #2#1 v
2151summary: Approximate hypebolic cosine
2152description:
2153 Returns the approximate hypebolic cosine.
2154
2155 See also @cosh().
2156end:
2157
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002158function: native_cosh
2159version: UNRELEASED
2160attrib: const
2161w: 1, 2, 3, 4
2162t: f16
2163ret: #2#1
2164arg: #2#1 v
2165test: none
2166end:
2167
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002168function: native_cospi
2169version: 21
2170attrib: const
2171w: 1, 2, 3, 4
2172t: f32
2173ret: #2#1
2174arg: #2#1 v
2175summary: Approximate cosine of a number multiplied by pi
2176description:
2177 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2178
2179 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2180
2181 See also @cospi().
2182end:
2183
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002184function: native_cospi
2185version: UNRELEASED
2186attrib: const
2187w: 1, 2, 3, 4
2188t: f16
2189ret: #2#1
2190arg: #2#1 v
2191test: none
2192end:
2193
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002194function: native_divide
2195version: 21
2196attrib: const
2197w: 1, 2, 3, 4
2198t: f32
2199ret: #2#1
2200arg: #2#1 left_vector
2201arg: #2#1 right_vector
2202summary: Approximate division
2203description:
2204 Computes the approximate division of two values.
2205end:
2206
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002207function: native_divide
2208version: UNRELEASED
2209attrib: const
2210w: 1, 2, 3, 4
2211t: f16
2212ret: #2#1
2213arg: #2#1 left_vector
2214arg: #2#1 right_vector
2215test: none
2216end:
2217
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002218function: native_exp
2219version: 18
2220attrib: const
2221w: 1, 2, 3, 4
2222t: f32
2223ret: #2#1
2224arg: #2#1 v, range(-86,86)
2225summary: Approximate e raised to a number
2226description:
2227 Fast approximate exp.
2228
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002229 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2230 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002231
2232 See also @exp().
2233test: limited
2234end:
2235
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002236function: native_exp
2237version: UNRELEASED
2238attrib: const
2239w: 1, 2, 3, 4
2240t: f16
2241ret: #2#1
2242# TODO Need range(-86, 86) here similar to the float version?
2243arg: #2#1 v
2244test: none
2245end:
2246
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002247function: native_exp10
2248version: 18
2249attrib: const
2250w: 1, 2, 3, 4
2251t: f32
2252ret: #2#1
2253arg: #2#1 v, range(-37,37)
2254summary: Approximate 10 raised to a number
2255description:
2256 Fast approximate exp10.
2257
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002258 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2259 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002260
2261 See also @exp10().
2262test: limited
2263end:
2264
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002265function: native_exp10
2266version: UNRELEASED
2267attrib: const
2268w: 1, 2, 3, 4
2269t: f16
2270ret: #2#1
2271# TODO Need range(-37, 37) here similar to the float version?
2272arg: #2#1 v
2273test: none
2274end:
2275
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002276function: native_exp2
2277version: 18
2278attrib: const
2279w: 1, 2, 3, 4
2280t: f32
2281ret: #2#1
2282arg: #2#1 v, range(-125,125)
2283summary: Approximate 2 raised to a number
2284description:
2285 Fast approximate exp2.
2286
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002287 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2288 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002289
2290 See also @exp2().
2291test: limited
2292end:
2293
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002294function: native_exp2
2295version: UNRELEASED
2296attrib: const
2297w: 1, 2, 3, 4
2298t: f16
2299ret: #2#1
2300# TODO Need range(-125, 125) here similar to the float version?
2301arg: #2#1 v
2302test: none
2303end:
2304
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002305function: native_expm1
2306version: 21
2307attrib: const
2308w: 1, 2, 3, 4
2309t: f32
2310ret: #2#1
2311arg: #2#1 v
2312summary: Approximate e raised to a number minus one
2313description:
2314 Returns the approximate (e ^ v) - 1.
2315
2316 See also @expm1().
2317end:
2318
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002319function: native_expm1
2320version: UNRELEASED
2321attrib: const
2322w: 1, 2, 3, 4
2323t: f16
2324ret: #2#1
2325arg: #2#1 v
2326test: none
2327end:
2328
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002329function: native_hypot
2330version: 21
2331attrib: const
2332w: 1, 2, 3, 4
2333t: f32
2334ret: #2#1
2335arg: #2#1 a
2336arg: #2#1 b
2337summary: Approximate hypotenuse
2338description:
2339 Returns the approximate native_sqrt(a * a + b * b)
2340
2341 See also @hypot().
2342end:
2343
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002344function: native_hypot
2345version: UNRELEASED
2346attrib: const
2347w: 1, 2, 3, 4
2348t: f16
2349ret: #2#1
2350arg: #2#1 a
2351arg: #2#1 b
2352test: none
2353end:
2354
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002355function: native_log
2356version: 18
2357attrib: const
2358w: 1, 2, 3, 4
2359t: f32
2360ret: #2#1
2361arg: #2#1 v, range(10e-10,10e10)
2362summary: Approximate natural logarithm
2363description:
2364 Fast approximate log.
2365
2366 It is not accurate for values very close to zero.
2367
2368 See also @log().
2369test: limited
2370end:
2371
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002372function: native_log
2373version: UNRELEASED
2374attrib: const
2375w: 1, 2, 3, 4
2376t: f16
2377ret: #2#1
2378# TODO Need range(10e-10,10e10) here similar to the float version?
2379arg: #2#1 v
2380test: none
2381end:
2382
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002383function: native_log10
2384version: 18
2385attrib: const
2386w: 1, 2, 3, 4
2387t: f32
2388ret: #2#1
2389arg: #2#1 v, range(10e-10,10e10)
2390summary: Approximate base 10 logarithm
2391description:
2392 Fast approximate log10.
2393
2394 It is not accurate for values very close to zero.
2395
2396 See also @log10().
2397test: limited
2398end:
2399
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002400function: native_log10
2401version: UNRELEASED
2402attrib: const
2403w: 1, 2, 3, 4
2404t: f16
2405ret: #2#1
2406# TODO Need range(10e-10,10e10) here similar to the float version?
2407arg: #2#1 v
2408test: none
2409end:
2410
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002411function: native_log1p
2412version: 21
2413attrib: const
2414w: 1, 2, 3, 4
2415t: f32
2416ret: #2#1
2417arg: #2#1 v
2418summary: Approximate natural logarithm of a value plus 1
2419description:
2420 Returns the approximate natural logarithm of (v + 1.0f)
2421
2422 See also @log1p().
2423end:
2424
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002425function: native_log1p
2426version: UNRELEASED
2427attrib: const
2428w: 1, 2, 3, 4
2429t: f16
2430ret: #2#1
2431arg: #2#1 v
2432test: none
2433end:
2434
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002435function: native_log2
2436version: 18
2437attrib: const
2438w: 1, 2, 3, 4
2439t: f32
2440ret: #2#1
2441arg: #2#1 v, range(10e-10,10e10)
2442summary: Approximate base 2 logarithm
2443description:
2444 Fast approximate log2.
2445
2446 It is not accurate for values very close to zero.
2447
2448 See also @log2().
2449test: limited
2450end:
2451
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002452function: native_log2
2453version: UNRELEASED
2454attrib: const
2455w: 1, 2, 3, 4
2456t: f16
2457ret: #2#1
2458# TODO Need range(10e-10,10e10) here similar to the float version?
2459arg: #2#1 v
2460test: none
2461end:
2462
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002463function: native_powr
2464version: 18
2465attrib: const
2466w: 1, 2, 3, 4
2467t: f32
2468ret: #2#1
2469arg: #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."
2470arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2471summary: Approximate positive base raised to an exponent
2472description:
2473 Fast approximate (base ^ exponent).
2474
2475 See also @powr().
2476test: limited
2477end:
2478
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002479function: native_powr
2480version: UNRELEASED
2481attrib: const
2482w: 1, 2, 3, 4
2483t: f16
2484ret: #2#1
2485# TODO Need range(0, 256) here similar to the float version?
2486arg: #2#1 base
2487# TODO Need range(-15,15) here similar to the float version?
2488arg: #2#1 exponent
2489test: none
2490end:
2491
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002492function: native_recip
2493version: 21
2494attrib: const
2495w: 1, 2, 3, 4
2496t: f32
2497ret: #2#1
2498arg: #2#1 v
2499summary: Approximate reciprocal
2500description:
2501 Returns the approximate approximate reciprocal of a value.
2502
2503 See also @half_recip().
2504end:
2505
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002506function: native_recip
2507version: UNRELEASED
2508attrib: const
2509w: 1, 2, 3, 4
2510t: f16
2511ret: #2#1
2512arg: #2#1 v
2513test: none
2514end:
2515
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002516function: native_rootn
2517version: 21
2518attrib: const
2519w: 1, 2, 3, 4
2520t: f32
2521ret: #2#1
2522arg: #2#1 v
2523arg: int#1 n
2524summary: Approximate nth root
2525description:
2526 Compute the approximate Nth root of a value.
2527
2528 See also @rootn().
2529end:
2530
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002531function: native_rootn
2532version: UNRELEASED
2533attrib: const
2534w: 1, 2, 3, 4
2535t: f16
2536ret: #2#1
2537arg: #2#1 v
2538arg: int#1 n
2539test: none
2540end:
2541
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002542function: native_rsqrt
2543version: 21
2544attrib: const
2545w: 1, 2, 3, 4
2546t: f32
2547ret: #2#1
2548arg: #2#1 v
2549summary: Approximate reciprocal of a square root
2550description:
2551 Returns approximate (1 / sqrt(v)).
2552
2553 See also @rsqrt(), @half_rsqrt().
2554end:
2555
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002556function: native_rsqrt
2557version: UNRELEASED
2558attrib: const
2559w: 1, 2, 3, 4
2560t: f16
2561ret: #2#1
2562arg: #2#1 v
2563test: none
2564end:
2565
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002566function: native_sin
2567version: 21
2568attrib: const
2569w: 1, 2, 3, 4
2570t: f32
2571ret: #2#1
2572arg: #2#1 v
2573summary: Approximate sine
2574description:
2575 Returns the approximate sine of an angle measured in radians.
2576
2577 See also @sin().
2578end:
2579
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002580function: native_sin
2581version: UNRELEASED
2582attrib: const
2583w: 1, 2, 3, 4
2584t: f16
2585ret: #2#1
2586arg: #2#1 v
2587test: none
2588end:
2589
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002590function: native_sincos
2591version: 21
2592w: 1, 2, 3, 4
2593t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002594ret: #2#1, "Sine."
2595arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002596arg: #2#1* cos, "*cos will be set to the cosine value."
2597summary: Approximate sine and cosine
2598description:
2599 Returns the approximate sine and cosine of a value.
2600
2601 See also @sincos().
2602# TODO Temporary
2603test: limited(0.0005)
2604end:
2605
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002606function: native_sincos
2607version: UNRELEASED
2608w: 1, 2, 3, 4
2609t: f16
2610ret: #2#1
2611arg: #2#1 v
2612arg: #2#1* cos
2613test: none
2614end:
2615
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002616function: native_sinh
2617version: 21
2618attrib: const
2619w: 1, 2, 3, 4
2620t: f32
2621ret: #2#1
2622arg: #2#1 v
2623summary: Approximate hyperbolic sine
2624description:
2625 Returns the approximate hyperbolic sine of a value specified in radians.
2626
2627 See also @sinh().
2628end:
2629
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002630function: native_sinh
2631version: UNRELEASED
2632attrib: const
2633w: 1, 2, 3, 4
2634t: f16
2635ret: #2#1
2636arg: #2#1 v
2637test: none
2638end:
2639
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002640function: native_sinpi
2641version: 21
2642attrib: const
2643w: 1, 2, 3, 4
2644t: f32
2645ret: #2#1
2646arg: #2#1 v
2647summary: Approximate sine of a number multiplied by pi
2648description:
2649 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2650
2651 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2652
2653 See also @sinpi().
2654end:
2655
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002656function: native_sinpi
2657version: UNRELEASED
2658attrib: const
2659w: 1, 2, 3, 4
2660t: f16
2661ret: #2#1
2662arg: #2#1 v
2663test: none
2664end:
2665
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002666function: native_sqrt
2667version: 21
2668attrib: const
2669w: 1, 2, 3, 4
2670t: f32
2671ret: #2#1
2672arg: #2#1 v
2673summary: Approximate square root
2674description:
2675 Returns the approximate sqrt(v).
2676
2677 See also @sqrt(), @half_sqrt().
2678end:
2679
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002680function: native_sqrt
2681version: UNRELEASED
2682attrib: const
2683w: 1, 2, 3, 4
2684t: f16
2685ret: #2#1
2686arg: #2#1 v
2687test: none
2688end:
2689
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002690function: native_tan
2691version: 21
2692attrib: const
2693w: 1, 2, 3, 4
2694t: f32
2695ret: #2#1
2696arg: #2#1 v
2697summary: Approximate tangent
2698description:
2699 Returns the approximate tangent of an angle measured in radians.
2700end:
2701
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002702function: native_tan
2703version: UNRELEASED
2704attrib: const
2705w: 1, 2, 3, 4
2706t: f16
2707ret: #2#1
2708arg: #2#1 v
2709test: none
2710end:
2711
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002712function: native_tanh
2713version: 21
2714attrib: const
2715w: 1, 2, 3, 4
2716t: f32
2717ret: #2#1
2718arg: #2#1 v
2719summary: Approximate hyperbolic tangent
2720description:
2721 Returns the approximate hyperbolic tangent of a value.
2722
2723 See also @tanh().
2724end:
2725
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002726function: native_tanh
2727version: UNRELEASED
2728attrib: const
2729w: 1, 2, 3, 4
2730t: f16
2731ret: #2#1
2732arg: #2#1 v
2733test: none
2734end:
2735
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002736function: native_tanpi
2737version: 21
2738attrib: const
2739w: 1, 2, 3, 4
2740t: f32
2741ret: #2#1
2742arg: #2#1 v
2743summary: Approximate tangent of a number multiplied by pi
2744description:
2745 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2746
2747 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2748
2749 See also @tanpi().
2750end:
2751
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002752function: native_tanpi
2753version: UNRELEASED
2754attrib: const
2755w: 1, 2, 3, 4
2756t: f16
2757ret: #2#1
2758arg: #2#1 v
2759test: none
2760end:
2761
2762# TODO add f16 nextafter
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002763function: nextafter
2764version: 9
2765attrib: const
2766w: 1, 2, 3, 4
2767t: f32
2768ret: #2#1
2769arg: #2#1 v
2770arg: #2#1 target
2771summary: Next floating point number
2772description:
2773 Returns the next representable floating point number from v towards target.
2774
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002775 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2776 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002777end:
2778
2779function: pow
2780version: 9
2781attrib: const
2782w: 1, 2, 3, 4
2783t: f32
2784ret: #2#1
2785arg: #2#1 base
2786arg: #2#1 exponent
2787summary: Base raised to an exponent
2788description:
2789 Returns base raised to the power exponent, i.e. base ^ exponent.
2790
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002791 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2792 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002793end:
2794
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002795function: pow
2796version: UNRELEASED
2797attrib: const
2798w: 1, 2, 3, 4
2799t: f16
2800ret: #2#1
2801arg: #2#1 base
2802arg: #2#1 exponent
2803test: none
2804end:
2805
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002806function: pown
2807version: 9
2808attrib: const
2809w: 1, 2, 3, 4
2810t: f32
2811ret: #2#1
2812arg: #2#1 base
2813arg: int#1 exponent
2814summary: Base raised to an integer exponent
2815description:
2816 Returns base raised to the power exponent, i.e. base ^ exponent.
2817
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002818 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2819 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002820end:
2821
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002822function: pown
2823version: UNRELEASED
2824attrib: const
2825w: 1, 2, 3, 4
2826t: f16
2827ret: #2#1
2828arg: #2#1 base
2829arg: int#1 exponent
2830test: none
2831end:
2832
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002833function: powr
2834version: 9
2835attrib: const
2836w: 1, 2, 3, 4
2837t: f32
2838ret: #2#1
2839arg: #2#1 base, range(0,3000)
2840arg: #2#1 exponent
2841summary: Positive base raised to an exponent
2842description:
2843 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2844
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002845 @pow() and @pown() are similar. They both make no assumptions about the base.
2846 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002847
2848 See also @native_powr().
2849end:
2850
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002851function: powr
2852version: UNRELEASED
2853attrib: const
2854w: 1, 2, 3, 4
2855t: f16
2856ret: #2#1
2857# TODO Need range(0,3000) here similar to the float version?
2858arg: #2#1 base
2859arg: #2#1 exponent
2860test: none
2861end:
2862
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002863function: radians
2864version: 9
2865attrib: const
2866w: 1, 2, 3, 4
2867t: f32
2868ret: #2#1
2869arg: #2#1 v
2870summary: Converts degrees into radians
2871description:
2872 Converts from degrees to radians.
2873end:
2874
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002875function: radians
2876version: UNRELEASED
2877attrib: const
2878w: 1, 2, 3, 4
2879t: f16
2880ret: #2#1
2881arg: #2#1 v
2882test: none
2883end:
2884
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002885function: remainder
2886version: 9
2887attrib: const
2888w: 1, 2, 3, 4
2889t: f32
2890ret: #2#1
2891arg: #2#1 numerator
2892arg: #2#1 denominator
2893summary: Remainder of a division
2894description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002895 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2896 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002897
2898 The function @fmod() is similar but rounds toward the closest interger.
2899 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2900 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2901end:
2902
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002903function: remainder
2904version: UNRELEASED
2905attrib: const
2906w: 1, 2, 3, 4
2907t: f16
2908ret: #2#1
2909arg: #2#1 numerator
2910arg: #2#1 denominator
2911test: none
2912end:
2913
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002914function: remquo
2915version: 9
2916w: 1, 2, 3, 4
2917t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002918ret: #2#1, "Remainder, precise only for the low three bits."
2919arg: #2#1 numerator, "Numerator."
2920arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002921arg: int#1* quotient, "*quotient will be set to the integer quotient."
2922summary: Remainder and quotient of a division
2923description:
2924 Returns the quotient and the remainder of (numerator / denominator).
2925
2926 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2927
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002928 This function is useful for implementing periodic functions. The low three bits of the
2929 quotient gives the quadrant and the remainder the distance within the quadrant.
2930 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2931 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002932
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002933 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2934 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002935test: custom
2936end:
2937
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002938function: remquo
2939version: UNRELEASED
2940w: 1, 2, 3, 4
2941t: f16
2942ret: #2#1
2943arg: #2#1 numerator
2944arg: #2#1 denominator
2945arg: int#1* quotient
2946test: none
2947end:
2948
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002949function: rint
2950version: 9
2951attrib: const
2952w: 1, 2, 3, 4
2953t: f32
2954ret: #2#1
2955arg: #2#1 v
2956summary: Round to even
2957description:
2958 Rounds to the nearest integral value.
2959
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002960 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2961 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2962 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002963
2964 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2965end:
2966
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002967function: rint
2968version: UNRELEASED
2969attrib: const
2970w: 1, 2, 3, 4
2971t: f16
2972ret: #2#1
2973arg: #2#1 v
2974test: none
2975end:
2976
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002977function: rootn
2978version: 9
2979attrib: const
2980w: 1, 2, 3, 4
2981t: f32
2982ret: #2#1
2983arg: #2#1 v
2984arg: int#1 n
2985summary: Nth root
2986description:
2987 Compute the Nth root of a value.
2988
2989 See also @native_rootn().
2990end:
2991
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002992function: rootn
2993version: UNRELEASED
2994attrib: const
2995w: 1, 2, 3, 4
2996t: f16
2997ret: #2#1
2998arg: #2#1 v
2999arg: int#1 n
3000test: none
3001end:
3002
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003003function: round
3004version: 9
3005attrib: const
3006w: 1, 2, 3, 4
3007t: f32
3008ret: #2#1
3009arg: #2#1 v
3010summary: Round away from zero
3011description:
3012 Round to the nearest integral value.
3013
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003014 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
3015 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
3016 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003017
3018 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
3019end:
3020
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003021function: round
3022version: UNRELEASED
3023attrib: const
3024w: 1, 2, 3, 4
3025t: f16
3026ret: #2#1
3027arg: #2#1 v
3028test: none
3029end:
3030
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003031function: rsqrt
3032version: 9
3033attrib: const
3034w: 1, 2, 3, 4
3035t: f32
3036ret: #2#1
3037arg: #2#1 v
3038summary: Reciprocal of a square root
3039description:
3040 Returns (1 / sqrt(v)).
3041
3042 See also @half_rsqrt(), @native_rsqrt().
3043end:
3044
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003045function: rsqrt
3046version: UNRELEASED
3047attrib: const
3048w: 1, 2, 3, 4
3049t: f16
3050ret: #2#1
3051arg: #2#1 v
3052test: none
3053end:
3054
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003055function: sign
3056version: 9
3057attrib: const
3058w: 1, 2, 3, 4
3059t: f32
3060ret: #2#1
3061arg: #2#1 v
3062summary: Sign of a value
3063description:
3064 Returns the sign of a value.
3065
3066 if (v &lt; 0) return -1.f;
3067 else if (v &gt; 0) return 1.f;
3068 else return 0.f;
3069end:
3070
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003071function: sign
3072version:UNRELEASED
3073attrib: const
3074w: 1, 2, 3, 4
3075t: f16
3076ret: #2#1
3077arg: #2#1 v
3078test: none
3079end:
3080
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003081function: sin
3082version: 9
3083attrib: const
3084w: 1, 2, 3, 4
3085t: f32
3086ret: #2#1
3087arg: #2#1 v
3088summary: Sine
3089description:
3090 Returns the sine of an angle measured in radians.
3091
3092 See also @native_sin().
3093end:
3094
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003095function: sin
3096version: UNRELEASED
3097attrib: const
3098w: 1, 2, 3, 4
3099t: f16
3100ret: #2#1
3101arg: #2#1 v
3102test: none
3103end:
3104
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003105function: sincos
3106version: 9
3107w: 1, 2, 3, 4
3108t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003109ret: #2#1, "Sine of v."
3110arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003111arg: #2#1* cos, "*cos will be set to the cosine value."
3112summary: Sine and cosine
3113description:
3114 Returns the sine and cosine of a value.
3115
3116 See also @native_sincos().
3117end:
3118
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003119function: sincos
3120version: UNRELEASED
3121w: 1, 2, 3, 4
3122t: f16
3123ret: #2#1
3124arg: #2#1 v
3125arg: #2#1* cos
3126test: none
3127end:
3128
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003129function: sinh
3130version: 9
3131attrib: const
3132w: 1, 2, 3, 4
3133t: f32
3134ret: #2#1
3135arg: #2#1 v
3136summary: Hyperbolic sine
3137description:
3138 Returns the hyperbolic sine of v, where v is measured in radians.
3139
3140 See also @native_sinh().
3141end:
3142
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003143function: sinh
3144version: UNRELEASED
3145attrib: const
3146w: 1, 2, 3, 4
3147t: f16
3148ret: #2#1
3149arg: #2#1 v
3150test: none
3151end:
3152
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003153function: sinpi
3154version: 9
3155attrib: const
3156w: 1, 2, 3, 4
3157t: f32
3158ret: #2#1
3159arg: #2#1 v
3160summary: Sine of a number multiplied by pi
3161description:
3162 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3163
3164 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3165
3166 See also @native_sinpi().
3167end:
3168
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003169function: sinpi
3170version: UNRELEASED
3171attrib: const
3172w: 1, 2, 3, 4
3173t: f16
3174ret: #2#1
3175arg: #2#1 v
3176test: none
3177end:
3178
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003179function: sqrt
3180version: 9
3181attrib: const
3182w: 1, 2, 3, 4
3183t: f32
3184ret: #2#1
3185arg: #2#1 v
3186summary: Square root
3187description:
3188 Returns the square root of a value.
3189
3190 See also @half_sqrt(), @native_sqrt().
3191end:
3192
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003193function: sqrt
3194version: UNRELEASED
3195attrib: const
3196w: 1, 2, 3, 4
3197t: f16
3198ret: #2#1
3199arg: #2#1 v
3200test: none
3201end:
3202
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003203function: step
3204version: 9
3205attrib: const
3206w: 1, 2, 3, 4
3207t: f32
3208ret: #2#1
3209arg: #2#1 edge
3210arg: #2#1 v
3211summary: 0 if less than a value, 0 otherwise
3212description:
3213 Returns 0.f if v &lt; edge, 1.f otherwise.
3214
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003215 This can be useful to create conditional computations without using loops and branching
3216 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3217 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 -07003218end:
3219
3220function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003221version: UNRELEASED
3222attrib: const
3223w: 1, 2, 3, 4
3224t: f16
3225ret: #2#1
3226arg: #2#1 edge
3227arg: #2#1 v
3228test: none
3229end:
3230
3231function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003232version: 9
3233attrib: const
3234w: 2, 3, 4
3235t: f32
3236ret: #2#1
3237arg: #2#1 edge
3238arg: #2 v
3239end:
3240
3241function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003242version: UNRELEASED
3243attrib: const
3244w: 2, 3, 4
3245t: f16
3246ret: #2#1
3247arg: #2#1 edge
3248arg: #2 v
3249test: none
3250end:
3251
3252function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003253version: 21
3254attrib: const
3255w: 2, 3, 4
3256t: f32
3257ret: #2#1
3258arg: #2 edge
3259arg: #2#1 v
3260end:
3261
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003262function: step
3263version: UNRELEASED
3264attrib: const
3265w: 2, 3, 4
3266t: f16
3267ret: #2#1
3268arg: #2 edge
3269arg: #2#1 v
3270test: none
3271end:
3272
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003273function: tan
3274version: 9
3275attrib: const
3276w: 1, 2, 3, 4
3277t: f32
3278ret: #2#1
3279arg: #2#1 v
3280summary: Tangent
3281description:
3282 Returns the tangent of an angle measured in radians.
3283
3284 See also @native_tan().
3285end:
3286
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003287function: tan
3288version: UNRELEASED
3289attrib: const
3290w: 1, 2, 3, 4
3291t: f16
3292ret: #2#1
3293arg: #2#1 v
3294test: none
3295end:
3296
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003297function: tanh
3298version: 9
3299attrib: const
3300w: 1, 2, 3, 4
3301t: f32
3302ret: #2#1
3303arg: #2#1 v
3304summary: Hyperbolic tangent
3305description:
3306 Returns the hyperbolic tangent of a value.
3307
3308 See also @native_tanh().
3309end:
3310
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003311function: tanh
3312version: UNRELEASED
3313attrib: const
3314w: 1, 2, 3, 4
3315t: f16
3316ret: #2#1
3317arg: #2#1 v
3318test: none
3319end:
3320
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003321function: tanpi
3322version: 9
3323attrib: const
3324w: 1, 2, 3, 4
3325t: f32
3326ret: #2#1
3327arg: #2#1 v
3328summary: Tangent of a number multiplied by pi
3329description:
3330 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3331
3332 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3333
3334 See also @native_tanpi().
3335end:
3336
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003337function: tanpi
3338version: UNRELEASED
3339attrib: const
3340w: 1, 2, 3, 4
3341t: f16
3342ret: #2#1
3343arg: #2#1 v
3344test: none
3345end:
3346
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003347function: tgamma
3348version: 9
3349attrib: const
3350w: 1, 2, 3, 4
3351t: f32
3352ret: #2#1
3353arg: #2#1 v
3354summary: Gamma function
3355description:
3356 Returns the gamma function of a value.
3357
3358 See also @lgamma().
3359end:
3360
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003361function: tgamma
3362version: UNRELEASED
3363attrib: const
3364w: 1, 2, 3, 4
3365t: f16
3366ret: #2#1
3367arg: #2#1 v
3368test: none
3369end:
3370
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003371function: trunc
3372version: 9
3373attrib: const
3374w: 1, 2, 3, 4
3375t: f32
3376ret: #2#1
3377arg: #2#1 v
3378summary: Truncates a floating point
3379description:
3380 Rounds to integral using truncation.
3381
3382 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3383
3384 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003385end:
3386
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003387function: trunc
3388version: UNRELEASED
3389attrib: const
3390w: 1, 2, 3, 4
3391t: f16
3392ret: #2#1
3393arg: #2#1 v
3394test: none
3395end:
3396
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003397function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003398attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003399t: i8, i16, i32, u8, u16, u32
3400ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003401arg: #1 amount, "Value to clamp."
3402arg: #1 low, "Lower bound."
3403arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003404deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003405summary: Restrain a value to a range
3406description:
3407 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003408test: none
3409end:
3410
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003411function: rsFrac
3412attrib: const
3413ret: float
3414arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003415deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003416summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003417description:
3418 Returns the fractional part of a float
3419test: none
3420end:
3421
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003422function: rsRand
3423ret: int
3424arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003425summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003426description:
3427 Return a random value between 0 (or min_value) and max_malue.
3428test: none
3429end:
3430
3431function: rsRand
3432ret: int
3433arg: int min_value
3434arg: int max_value
3435test: none
3436end:
3437
3438function: rsRand
3439ret: float
3440arg: float max_value
3441test: none
3442end:
3443
3444function: rsRand
3445ret: float
3446arg: float min_value
3447arg: float max_value
3448test: none
3449end: