blob: b39061095e151c5d6c1e4e6d75d68688c0b9da0e [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
1082version: 9
1083attrib: 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
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001093# TODO Add f16 frexp
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001094function: frexp
1095version: 9
1096w: 1, 2, 3, 4
1097t: f32
1098ret: #2#1
1099arg: #2#1 v, "Input value."
1100arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
1101summary: Binary mantissa and exponent
1102description:
1103 Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
1104
1105 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
1106
1107 See @ldexp() for the reverse operation. See also @logb() and @ilogb().
1108end:
1109
1110function: half_recip
1111version: 17
1112attrib: const
1113w: 1, 2, 3, 4
1114t: f32
1115ret: #2#1
1116arg: #2#1 v
1117summary: Reciprocal computed to 16 bit precision
1118description:
1119 Returns the approximate reciprocal of a value.
1120
1121 The precision is that of a 16 bit floating point value.
1122
1123 See also @native_recip().
1124end:
1125
1126function: half_rsqrt
1127version: 17
1128attrib: const
1129w: 1, 2, 3, 4
1130t: f32
1131ret: #2#1
1132arg: #2#1 v
1133summary: Reciprocal of a square root computed to 16 bit precision
1134description:
1135 Returns the approximate value of <code>(1.f / sqrt(value))</code>.
1136
1137 The precision is that of a 16 bit floating point value.
1138
1139 See also @rsqrt(), @native_rsqrt().
1140end:
1141
1142function: half_sqrt
1143version: 17
1144attrib: const
1145w: 1, 2, 3, 4
1146t: f32
1147ret: #2#1
1148arg: #2#1 v
1149summary: Square root computed to 16 bit precision
1150description:
1151 Returns the approximate square root of a value.
1152
1153 The precision is that of a 16 bit floating point value.
1154
1155 See also @sqrt(), @native_sqrt().
1156end:
1157
1158function: hypot
1159version: 9
1160attrib: const
1161w: 1, 2, 3, 4
1162t: f32
1163ret: #2#1
1164arg: #2#1 a
1165arg: #2#1 b
1166summary: Hypotenuse
1167description:
1168 Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
1169
1170 See also @native_hypot().
1171end:
1172
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001173function: hypot
1174version: UNRELEASED
1175attrib: const
1176w: 1, 2, 3, 4
1177t: f16
1178ret: #2#1
1179arg: #2#1 a
1180arg: #2#1 b
1181test: none
1182end:
1183
1184# TODO Add f16 ilogb. Should its return be short?
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001185function: ilogb
1186version: 9
1187attrib: const
1188w: 1, 2, 3, 4
1189t: f32
1190ret: int#1
1191arg: float#1 v
1192summary: Base two exponent
1193description:
1194 Returns the base two exponent of a value, where the mantissa is between
1195 1.f (inclusive) and 2.f (exclusive).
1196
1197 For example, <code>ilogb(8.5f)</code> returns 3.
1198
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001199 Because of the difference in mantissa, this number is one less than is returned by @frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001200
1201 @logb() is similar but returns a float.
1202test: custom
1203end:
1204
1205function: ldexp
1206version: 9
1207attrib: const
1208w: 1, 2, 3, 4
1209ret: float#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001210arg: float#1 mantissa, "Mantissa."
1211arg: int#1 exponent, "Exponent, a single component or matching vector."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001212summary: Creates a floating point from mantissa and exponent
1213description:
1214 Returns the floating point created from the mantissa and exponent,
1215 i.e. (mantissa * 2 ^ exponent).
1216
1217 See @frexp() for the reverse operation.
1218end:
1219
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001220# TODO Should this parameter be a short?
1221function: ldexp
1222version: UNRELEASED
1223attrib: const
1224w: 1, 2, 3, 4
1225ret: half#1
1226arg: half#1 mantissa
1227arg: int#1 exponent
1228test: none
1229end:
1230
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001231function: ldexp
1232version: 9
1233attrib: const
1234w: 2, 3, 4
1235ret: float#1
1236arg: float#1 mantissa
1237arg: int exponent
1238end:
1239
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001240function: ldexp
1241version: UNRELEASED
1242attrib: const
1243w: 2, 3, 4
1244ret: half#1
1245arg: half#1 mantissa
1246arg: int exponent
1247test: none
1248end:
1249
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001250function: lgamma
1251version: 9
1252attrib: const
1253w: 1, 2, 3, 4
1254t: f32
1255ret: #2#1
1256arg: #2#1 v
1257summary: Natural logarithm of the gamma function
1258description:
1259 Returns the natural logarithm of the absolute value of the gamma function,
1260 i.e. <code>@log(@fabs(@tgamma(v)))</code>.
1261
1262 See also @tgamma().
1263end:
1264
1265function: lgamma
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001266version: UNRELEASED
1267attrib: const
1268w: 1, 2, 3, 4
1269t: f16
1270ret: #2#1
1271arg: #2#1 v
1272test: none
1273end:
1274
1275function: lgamma
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001276version: 9
1277w: 1, 2, 3, 4
1278t: f32
1279ret: #2#1
1280arg: #2#1 v
1281arg: 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."
1282test: custom
1283#TODO Temporary until bionic & associated drivers are fixed
1284end:
1285
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001286function: lgamma
1287version: UNRELEASED
1288w: 1, 2, 3, 4
1289t: f16
1290ret: #2#1
1291arg: #2#1 v
1292arg: int#1* sign_of_gamma
1293test: none
1294end:
1295
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001296function: log
1297version: 9
1298attrib: const
1299w: 1, 2, 3, 4
1300t: f32
1301ret: #2#1
1302arg: #2#1 v
1303summary: Natural logarithm
1304description:
1305 Returns the natural logarithm.
1306
1307 See also @native_log().
1308end:
1309
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001310function: log
1311version: UNRELEASED
1312attrib: const
1313w: 1, 2, 3, 4
1314t: f16
1315ret: #2#1
1316arg: #2#1 v
1317test: none
1318end:
1319
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001320function: log10
1321version: 9
1322attrib: const
1323w: 1, 2, 3, 4
1324t: f32
1325ret: #2#1
1326arg: #2#1 v
1327summary: Base 10 logarithm
1328description:
1329 Returns the base 10 logarithm.
1330
1331 See also @native_log10().
1332end:
1333
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001334function: log10
1335version: UNRELEASED
1336attrib: const
1337w: 1, 2, 3, 4
1338t: f16
1339ret: #2#1
1340arg: #2#1 v
1341test: none
1342end:
1343
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001344function: log1p
1345version: 9
1346attrib: const
1347w: 1, 2, 3, 4
1348t: f32
1349ret: #2#1
1350arg: #2#1 v
1351summary: Natural logarithm of a value plus 1
1352description:
1353 Returns the natural logarithm of <code>(v + 1.f)</code>.
1354
1355 See also @native_log1p().
1356end:
1357
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001358function: log1p
1359version: UNRELEASED
1360attrib: const
1361w: 1, 2, 3, 4
1362t: f16
1363ret: #2#1
1364arg: #2#1 v
1365test: none
1366end:
1367
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001368function: log2
1369version: 9
1370attrib: const
1371w: 1, 2, 3, 4
1372t: f32
1373ret: #2#1
1374arg: #2#1 v
1375summary: Base 2 logarithm
1376description:
1377 Returns the base 2 logarithm.
1378
1379 See also @native_log2().
1380end:
1381
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001382function: log2
1383version: UNRELEASED
1384attrib: const
1385w: 1, 2, 3, 4
1386t: f16
1387ret: #2#1
1388arg: #2#1 v
1389test: none
1390end:
1391
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001392function: logb
1393version: 9
1394attrib: const
1395w: 1, 2, 3, 4
1396t: f32
1397ret: #2#1
1398arg: #2#1 v
1399summary: Base two exponent
1400description:
1401 Returns the base two exponent of a value, where the mantissa is between
1402 1.f (inclusive) and 2.f (exclusive).
1403
1404 For example, <code>logb(8.5f)</code> returns 3.f.
1405
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001406 Because of the difference in mantissa, this number is one less than is returned by frexp().
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001407
1408 @ilogb() is similar but returns an integer.
1409end:
1410
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001411function: logb
1412version: UNRELEASED
1413attrib: const
1414w: 1, 2, 3, 4
1415t: f16
1416ret: #2#1
1417arg: #2#1 v
1418test: none
1419end:
1420
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001421function: mad
1422version: 9
1423attrib: const
1424w: 1, 2, 3, 4
1425t: f32
1426ret: #2#1
1427arg: #2#1 multiplicand1
1428arg: #2#1 multiplicand2
1429arg: #2#1 offset
1430summary: Multiply and add
1431description:
1432 Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
1433
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001434 This function is similar to @fma(). @fma() retains full precision of the multiplied result
1435 and rounds only after the addition. mad() rounds after the multiplication and the addition.
1436 In rs_fp_relaxed mode, mad() may not do the rounding after multiplicaiton.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001437end:
1438
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001439function: mad
1440version: UNRELEASED
1441attrib: const
1442w: 1, 2, 3, 4
1443t: f16
1444ret: #2#1
1445arg: #2#1 multiplicand1
1446arg: #2#1 multiplicand2
1447arg: #2#1 offset
1448test: none
1449end:
1450
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001451function: max
1452version: 9
1453attrib: const
1454w: 1, 2, 3, 4
1455t: f32
1456ret: #2#1
1457arg: #2#1 a
1458arg: #2#1 b
1459summary: Maximum
1460description:
1461 Returns the maximum value of two arguments.
1462end:
1463
1464function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001465version:UNRELEASED
1466attrib: const
1467w: 1, 2, 3, 4
1468t: f16
1469ret: #2#1
1470arg: #2#1 a
1471arg: #2#1 b
1472test: none
1473end:
1474
1475function: max
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001476version: 9
1477attrib: const
1478w: 2, 3, 4
1479t: f32
1480ret: #2#1
1481arg: #2#1 a
1482arg: #2 b
1483end:
1484
1485function: max
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001486version: UNRELEASED
1487attrib: const
1488w: 2, 3, 4
1489t: f16
1490ret: #2#1
1491arg: #2#1 a
1492arg: #2 b
1493test: none
1494end:
1495
1496function: max
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001497version: 9 20
1498attrib: const
1499w: 1
1500t: i8, i16, i32, u8, u16, u32
1501ret: #2#1
1502arg: #2#1 a
1503arg: #2#1 b
1504inline:
1505 return (a > b ? a : b);
1506end:
1507
1508function: max
1509version: 9 20
1510attrib: const
1511w: 2
1512t: i8, i16, i32, u8, u16, u32
1513ret: #2#1
1514arg: #2#1 a
1515arg: #2#1 b
1516inline:
1517 #2#1 tmp;
1518 tmp.x = (a.x > b.x ? a.x : b.x);
1519 tmp.y = (a.y > b.y ? a.y : b.y);
1520 return tmp;
1521end:
1522
1523function: max
1524version: 9 20
1525attrib: const
1526w: 3
1527t: i8, i16, i32, u8, u16, u32
1528ret: #2#1
1529arg: #2#1 a
1530arg: #2#1 b
1531inline:
1532 #2#1 tmp;
1533 tmp.x = (a.x > b.x ? a.x : b.x);
1534 tmp.y = (a.y > b.y ? a.y : b.y);
1535 tmp.z = (a.z > b.z ? a.z : b.z);
1536 return tmp;
1537end:
1538
1539function: max
1540version: 9 20
1541attrib: const
1542w: 4
1543t: i8, i16, i32, u8, u16, u32
1544ret: #2#1
1545arg: #2#1 a
1546arg: #2#1 b
1547inline:
1548 #2#1 tmp;
1549 tmp.x = (a.x > b.x ? a.x : b.x);
1550 tmp.y = (a.y > b.y ? a.y : b.y);
1551 tmp.z = (a.z > b.z ? a.z : b.z);
1552 tmp.w = (a.w > b.w ? a.w : b.w);
1553 return tmp;
1554end:
1555
1556function: max
1557version: 21
1558attrib: const
1559w: 1, 2, 3, 4
1560t: i8, i16, i32, i64, u8, u16, u32, u64
1561ret: #2#1
1562arg: #2#1 a
1563arg: #2#1 b
1564end:
1565
1566function: min
1567version: 9
1568attrib: const
1569w: 1, 2, 3, 4
1570t: f32
1571ret: #2#1
1572arg: #2#1 a
1573arg: #2#1 b
1574summary: Minimum
1575description:
1576 Returns the minimum value of two arguments.
1577end:
1578
1579function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001580version: UNRELEASED
1581attrib: const
1582w: 1, 2, 3, 4
1583t: f16
1584ret: #2#1
1585arg: #2#1 a
1586arg: #2#1 b
1587test: none
1588end:
1589
1590function: min
Jean-Luc Brouillet7cf263d2015-08-20 17:30:41 -07001591version: 9
1592attrib: const
1593w: 2, 3, 4
1594t: f32
1595ret: #2#1
1596arg: #2#1 a
1597arg: #2 b
1598end:
1599
1600function: min
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001601version: UNRELEASED
1602attrib: const
1603w: 2, 3, 4
1604t: f16
1605ret: #2#1
1606arg: #2#1 a
1607arg: #2 b
1608test: none
1609end:
1610
1611function: min
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001612version: 9 20
1613attrib: const
1614w: 1
1615t: i8, i16, i32, u8, u16, u32
1616ret: #2#1
1617arg: #2#1 a
1618arg: #2#1 b
1619inline:
1620 return (a < b ? a : b);
1621end:
1622
1623function: min
1624version: 9 20
1625attrib: const
1626w: 2
1627t: i8, i16, i32, u8, u16, u32
1628ret: #2#1
1629arg: #2#1 a
1630arg: #2#1 b
1631inline:
1632 #2#1 tmp;
1633 tmp.x = (a.x < b.x ? a.x : b.x);
1634 tmp.y = (a.y < b.y ? a.y : b.y);
1635 return tmp;
1636end:
1637
1638function: min
1639version: 9 20
1640attrib: const
1641w: 3
1642t: i8, i16, i32, u8, u16, u32
1643ret: #2#1
1644arg: #2#1 a
1645arg: #2#1 b
1646inline:
1647 #2#1 tmp;
1648 tmp.x = (a.x < b.x ? a.x : b.x);
1649 tmp.y = (a.y < b.y ? a.y : b.y);
1650 tmp.z = (a.z < b.z ? a.z : b.z);
1651 return tmp;
1652end:
1653
1654function: min
1655version: 9 20
1656attrib: const
1657w: 4
1658t: i8, i16, i32, u8, u16, u32
1659ret: #2#1
1660arg: #2#1 a
1661arg: #2#1 b
1662inline:
1663 #2#1 tmp;
1664 tmp.x = (a.x < b.x ? a.x : b.x);
1665 tmp.y = (a.y < b.y ? a.y : b.y);
1666 tmp.z = (a.z < b.z ? a.z : b.z);
1667 tmp.w = (a.w < b.w ? a.w : b.w);
1668 return tmp;
1669end:
1670
1671function: min
1672version: 21
1673attrib: const
1674w: 1, 2, 3, 4
1675t: i8, i16, i32, i64, u8, u16, u32, u64
1676ret: #2#1
1677arg: #2#1 a
1678arg: #2#1 b
1679end:
1680
1681function: mix
1682version: 9
1683attrib: const
1684w: 1, 2, 3, 4
1685t: f32
1686ret: #2#1
1687arg: #2#1 start
1688arg: #2#1 stop
1689arg: #2#1 fraction
1690summary: Mixes two values
1691description:
1692 Returns start + ((stop - start) * fraction).
1693
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001694 This can be useful for mixing two values. For example, to create a new color that is
1695 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001696end:
1697
1698function: mix
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001699version: UNRELEASED
1700attrib: const
1701w: 1, 2, 3, 4
1702t: f16
1703ret: #2#1
1704arg: #2#1 start
1705arg: #2#1 stop
1706arg: #2#1 fraction
1707test: none
1708end:
1709
1710function: mix
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001711version: 9
1712attrib: const
1713w: 2, 3, 4
1714t: f32
1715ret: #2#1
1716arg: #2#1 start
1717arg: #2#1 stop
1718arg: #2 fraction
1719end:
1720
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001721function: mix
1722version: UNRELEASED
1723attrib: const
1724w: 2, 3, 4
1725t: f16
1726ret: #2#1
1727arg: #2#1 start
1728arg: #2#1 stop
1729arg: #2 fraction
1730test: none
1731end:
1732
1733# TODO Add f16 modf
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001734function: modf
1735version: 9
1736w: 1, 2, 3, 4
1737t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001738ret: #2#1, "Floating point portion of the value."
1739arg: #2#1 v, "Source value."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001740arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
1741summary: Integral and fractional components
1742description:
1743 Returns the integral and fractional components of a number.
1744
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001745 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 -08001746 *integral_part will be set to -3.f and .72f will be returned.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001747end:
1748
1749function: nan
1750version: 9
1751attrib: const
1752w: 1
1753t: f32
1754ret: #2#1
1755arg: uint#1 v, "Not used."
1756#TODO We're not using the argument. Once we do, add this documentation line:
1757# The argument is embedded into the return value and can be used to distinguish various NaNs.
1758summary: Not a Number
1759description:
1760 Returns a NaN value (Not a Number).
1761end:
1762
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001763function: nan_half
1764version: UNRELEASED
1765attrib: const
1766t: f16
1767ret: #1
1768summary: Not a Number
1769description:
1770 Returns a half-precision floating point NaN value (Not a Number).
1771test: none
1772end:
1773
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001774function: native_acos
1775version: 21
1776attrib: const
1777w: 1, 2, 3, 4
1778t: f32
1779ret: #2#1
1780arg: #2#1 v, range(-1,1)
1781summary: Approximate inverse cosine
1782description:
1783 Returns the approximate inverse cosine, in radians.
1784
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001785 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001786
1787 See also @acos().
1788# TODO Temporary
1789test: limited(0.0005)
1790end:
1791
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001792function: native_acos
1793version: UNRELEASED
1794attrib: const
1795w: 1, 2, 3, 4
1796t: f16
1797ret: #2#1
1798# TODO Need range(-1,1) here similar to the float version?
1799arg: #2#1 v
1800test: none
1801end:
1802
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001803function: native_acosh
1804version: 21
1805attrib: const
1806w: 1, 2, 3, 4
1807t: f32
1808ret: #2#1
1809arg: #2#1 v
1810summary: Approximate inverse hyperbolic cosine
1811description:
1812 Returns the approximate inverse hyperbolic cosine, in radians.
1813
1814 See also @acosh().
1815# TODO Temporary
1816test: limited(0.0005)
1817end:
1818
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001819function: native_acosh
1820version: UNRELEASED
1821attrib: const
1822w: 1, 2, 3, 4
1823t: f16
1824ret: #2#1
1825arg: #2#1 v
1826test: none
1827end:
1828
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001829function: native_acospi
1830version: 21
1831attrib: const
1832w: 1, 2, 3, 4
1833t: f32
1834ret: #2#1
1835arg: #2#1 v, range(-1,1)
1836summary: Approximate inverse cosine divided by pi
1837description:
1838 Returns the approximate inverse cosine in radians, divided by pi.
1839
1840 To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
1841
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001842 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001843
1844 See also @acospi().
1845# TODO Temporary
1846test: limited(0.0005)
1847end:
1848
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001849function: native_acospi
1850version: UNRELEASED
1851attrib: const
1852w: 1, 2, 3, 4
1853t: f16
1854ret: #2#1
1855# TODO Need range(-1,1) here similar to the float version?
1856arg: #2#1 v
1857test: none
1858end:
1859
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001860function: native_asin
1861version: 21
1862attrib: const
1863w: 1, 2, 3, 4
1864t: f32
1865ret: #2#1
1866arg: #2#1 v, range(-1,1)
1867summary: Approximate inverse sine
1868description:
1869 Returns the approximate inverse sine, in radians.
1870
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001871 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001872
1873 See also @asin().
1874# TODO Temporary
1875test: limited(0.0005)
1876end:
1877
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001878function: native_asin
1879version: UNRELEASED
1880attrib: const
1881w: 1, 2, 3, 4
1882t: f16
1883ret: #2#1
1884# TODO Need range(-1,1) here similar to the float version?
1885arg: #2#1 v
1886test: none
1887end:
1888
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001889function: native_asinh
1890version: 21
1891attrib: const
1892w: 1, 2, 3, 4
1893t: f32
1894ret: #2#1
1895arg: #2#1 v
1896summary: Approximate inverse hyperbolic sine
1897description:
1898 Returns the approximate inverse hyperbolic sine, in radians.
1899
1900 See also @asinh().
1901# TODO Temporary
1902test: limited(0.0005)
1903end:
1904
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001905function: native_asinh
1906version: UNRELEASED
1907attrib: const
1908w: 1, 2, 3, 4
1909t: f16
1910ret: #2#1
1911arg: #2#1 v
1912test: none
1913end:
1914
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001915function: native_asinpi
1916version: 21
1917attrib: const
1918w: 1, 2, 3, 4
1919t: f32
1920ret: #2#1
1921arg: #2#1 v, range(-1,1)
1922summary: Approximate inverse sine divided by pi
1923description:
1924 Returns the approximate inverse sine in radians, divided by pi.
1925
1926 To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
1927
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001928 This function yields undefined results from input values less than -1 or greater than 1.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001929
1930 See also @asinpi().
1931# TODO Temporary
1932test: limited(0.0005)
1933end:
1934
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001935function: native_asinpi
1936version: UNRELEASED
1937attrib: const
1938w: 1, 2, 3, 4
1939t: f16
1940ret: #2#1
1941# TODO Need range(-1,1) here similar to the float version?
1942arg: #2#1 v
1943test: none
1944end:
1945
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001946function: native_atan
1947version: 21
1948attrib: const
1949w: 1, 2, 3, 4
1950t: f32
1951ret: #2#1
1952arg: #2#1 v, range(-1,1)
1953summary: Approximate inverse tangent
1954description:
1955 Returns the approximate inverse tangent, in radians.
1956
1957 See also @atan().
1958# TODO Temporary
1959test: limited(0.0005)
1960end:
1961
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001962function: native_atan
1963version: UNRELEASED
1964attrib: const
1965w: 1, 2, 3, 4
1966t: f16
1967ret: #2#1
1968# TODO Need range(-1,1) here similar to the float version?
1969arg: #2#1 v
1970test: none
1971end:
1972
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001973function: native_atan2
1974version: 21
1975attrib: const
1976w: 1, 2, 3, 4
1977t: f32
1978ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07001979arg: #2#1 numerator, "Numerator."
1980arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07001981summary: Approximate inverse tangent of a ratio
1982description:
1983 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
1984
1985 See also @atan2().
1986# TODO Temporary
1987test: limited(0.0005)
1988end:
1989
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08001990function: native_atan2
1991version: UNRELEASED
1992attrib: const
1993w: 1, 2, 3, 4
1994t: f16
1995ret: #2#1
1996arg: #2#1 numerator
1997arg: #2#1 denominator
1998test: none
1999end:
2000
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002001function: native_atan2pi
2002version: 21
2003attrib: const
2004w: 1, 2, 3, 4
2005t: f32
2006ret: #2#1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002007arg: #2#1 numerator, "Numerator."
2008arg: #2#1 denominator, "Denominator. Can be 0."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002009summary: Approximate inverse tangent of a ratio, divided by pi
2010description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002011 Returns the approximate inverse tangent of <code>(numerator / denominator)</code>,
2012 in radians, divided by pi.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002013
2014 To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
2015
2016 See also @atan2pi().
2017# TODO Temporary
2018test: limited(0.0005)
2019end:
2020
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002021function: native_atan2pi
2022version: UNRELEASED
2023attrib: const
2024w: 1, 2, 3, 4
2025t: f16
2026ret: #2#1
2027arg: #2#1 numerator
2028arg: #2#1 denominator
2029test: none
2030end:
2031
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002032function: native_atanh
2033version: 21
2034attrib: const
2035w: 1, 2, 3, 4
2036t: f32
2037ret: #2#1
2038arg: #2#1 v, range(-1,1)
2039summary: Approximate inverse hyperbolic tangent
2040description:
2041 Returns the approximate inverse hyperbolic tangent, in radians.
2042
2043 See also @atanh().
2044# TODO Temporary
2045test: limited(0.0005)
2046end:
2047
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002048function: native_atanh
2049version: UNRELEASED
2050attrib: const
2051w: 1, 2, 3, 4
2052t: f16
2053ret: #2#1
2054# TODO Need range(-1,1) here similar to the float version?
2055arg: #2#1 v
2056test: none
2057end:
2058
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002059function: native_atanpi
2060version: 21
2061attrib: const
2062w: 1, 2, 3, 4
2063t: f32
2064ret: #2#1
2065arg: #2#1 v, range(-1,1)
2066summary: Approximate inverse tangent divided by pi
2067description:
2068 Returns the approximate inverse tangent in radians, divided by pi.
2069
2070 To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
2071
2072 See also @atanpi().
2073# TODO Temporary
2074test: limited(0.0005)
2075end:
2076
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002077function: native_atanpi
2078version: UNRELEASED
2079attrib: const
2080w: 1, 2, 3, 4
2081t: f16
2082ret: #2#1
2083# TODO Need range(-1,1) here similar to the float version?
2084arg: #2#1 v
2085test: none
2086end:
2087
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002088function: native_cbrt
2089version: 21
2090attrib: const
2091w: 1, 2, 3, 4
2092t: f32
2093ret: #2#1
2094arg: #2#1 v
2095summary: Approximate cube root
2096description:
2097 Returns the approximate cubic root.
2098
2099 See also @cbrt().
2100end:
2101
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002102function: native_cbrt
2103version: UNRELEASED
2104attrib: const
2105w: 1, 2, 3, 4
2106t: f16
2107ret: #2#1
2108arg: #2#1 v
2109test: none
2110end:
2111
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002112function: native_cos
2113version: 21
2114attrib: const
2115w: 1, 2, 3, 4
2116t: f32
2117ret: #2#1
2118arg: #2#1 v
2119summary: Approximate cosine
2120description:
2121 Returns the approximate cosine of an angle measured in radians.
2122
2123 See also @cos().
2124end:
2125
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002126function: native_cos
2127version: UNRELEASED
2128attrib: const
2129w: 1, 2, 3, 4
2130t: f16
2131ret: #2#1
2132arg: #2#1 v
2133test: none
2134end:
2135
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002136function: native_cosh
2137version: 21
2138attrib: const
2139w: 1, 2, 3, 4
2140t: f32
2141ret: #2#1
2142arg: #2#1 v
2143summary: Approximate hypebolic cosine
2144description:
2145 Returns the approximate hypebolic cosine.
2146
2147 See also @cosh().
2148end:
2149
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002150function: native_cosh
2151version: UNRELEASED
2152attrib: const
2153w: 1, 2, 3, 4
2154t: f16
2155ret: #2#1
2156arg: #2#1 v
2157test: none
2158end:
2159
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002160function: native_cospi
2161version: 21
2162attrib: const
2163w: 1, 2, 3, 4
2164t: f32
2165ret: #2#1
2166arg: #2#1 v
2167summary: Approximate cosine of a number multiplied by pi
2168description:
2169 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
2170
2171 To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
2172
2173 See also @cospi().
2174end:
2175
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002176function: native_cospi
2177version: UNRELEASED
2178attrib: const
2179w: 1, 2, 3, 4
2180t: f16
2181ret: #2#1
2182arg: #2#1 v
2183test: none
2184end:
2185
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002186function: native_divide
2187version: 21
2188attrib: const
2189w: 1, 2, 3, 4
2190t: f32
2191ret: #2#1
2192arg: #2#1 left_vector
2193arg: #2#1 right_vector
2194summary: Approximate division
2195description:
2196 Computes the approximate division of two values.
2197end:
2198
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002199function: native_divide
2200version: UNRELEASED
2201attrib: const
2202w: 1, 2, 3, 4
2203t: f16
2204ret: #2#1
2205arg: #2#1 left_vector
2206arg: #2#1 right_vector
2207test: none
2208end:
2209
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002210function: native_exp
2211version: 18
2212attrib: const
2213w: 1, 2, 3, 4
2214t: f32
2215ret: #2#1
2216arg: #2#1 v, range(-86,86)
2217summary: Approximate e raised to a number
2218description:
2219 Fast approximate exp.
2220
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002221 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be
2222 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002223
2224 See also @exp().
2225test: limited
2226end:
2227
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002228function: native_exp
2229version: UNRELEASED
2230attrib: const
2231w: 1, 2, 3, 4
2232t: f16
2233ret: #2#1
2234# TODO Need range(-86, 86) here similar to the float version?
2235arg: #2#1 v
2236test: none
2237end:
2238
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002239function: native_exp10
2240version: 18
2241attrib: const
2242w: 1, 2, 3, 4
2243t: f32
2244ret: #2#1
2245arg: #2#1 v, range(-37,37)
2246summary: Approximate 10 raised to a number
2247description:
2248 Fast approximate exp10.
2249
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002250 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be
2251 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002252
2253 See also @exp10().
2254test: limited
2255end:
2256
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002257function: native_exp10
2258version: UNRELEASED
2259attrib: const
2260w: 1, 2, 3, 4
2261t: f16
2262ret: #2#1
2263# TODO Need range(-37, 37) here similar to the float version?
2264arg: #2#1 v
2265test: none
2266end:
2267
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002268function: native_exp2
2269version: 18
2270attrib: const
2271w: 1, 2, 3, 4
2272t: f32
2273ret: #2#1
2274arg: #2#1 v, range(-125,125)
2275summary: Approximate 2 raised to a number
2276description:
2277 Fast approximate exp2.
2278
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002279 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be
2280 expected from using 16 bit floating point values.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002281
2282 See also @exp2().
2283test: limited
2284end:
2285
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002286function: native_exp2
2287version: UNRELEASED
2288attrib: const
2289w: 1, 2, 3, 4
2290t: f16
2291ret: #2#1
2292# TODO Need range(-125, 125) here similar to the float version?
2293arg: #2#1 v
2294test: none
2295end:
2296
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002297function: native_expm1
2298version: 21
2299attrib: const
2300w: 1, 2, 3, 4
2301t: f32
2302ret: #2#1
2303arg: #2#1 v
2304summary: Approximate e raised to a number minus one
2305description:
2306 Returns the approximate (e ^ v) - 1.
2307
2308 See also @expm1().
2309end:
2310
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002311function: native_expm1
2312version: UNRELEASED
2313attrib: const
2314w: 1, 2, 3, 4
2315t: f16
2316ret: #2#1
2317arg: #2#1 v
2318test: none
2319end:
2320
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002321function: native_hypot
2322version: 21
2323attrib: const
2324w: 1, 2, 3, 4
2325t: f32
2326ret: #2#1
2327arg: #2#1 a
2328arg: #2#1 b
2329summary: Approximate hypotenuse
2330description:
2331 Returns the approximate native_sqrt(a * a + b * b)
2332
2333 See also @hypot().
2334end:
2335
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002336function: native_hypot
2337version: UNRELEASED
2338attrib: const
2339w: 1, 2, 3, 4
2340t: f16
2341ret: #2#1
2342arg: #2#1 a
2343arg: #2#1 b
2344test: none
2345end:
2346
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002347function: native_log
2348version: 18
2349attrib: const
2350w: 1, 2, 3, 4
2351t: f32
2352ret: #2#1
2353arg: #2#1 v, range(10e-10,10e10)
2354summary: Approximate natural logarithm
2355description:
2356 Fast approximate log.
2357
2358 It is not accurate for values very close to zero.
2359
2360 See also @log().
2361test: limited
2362end:
2363
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002364function: native_log
2365version: UNRELEASED
2366attrib: const
2367w: 1, 2, 3, 4
2368t: f16
2369ret: #2#1
2370# TODO Need range(10e-10,10e10) here similar to the float version?
2371arg: #2#1 v
2372test: none
2373end:
2374
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002375function: native_log10
2376version: 18
2377attrib: const
2378w: 1, 2, 3, 4
2379t: f32
2380ret: #2#1
2381arg: #2#1 v, range(10e-10,10e10)
2382summary: Approximate base 10 logarithm
2383description:
2384 Fast approximate log10.
2385
2386 It is not accurate for values very close to zero.
2387
2388 See also @log10().
2389test: limited
2390end:
2391
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002392function: native_log10
2393version: UNRELEASED
2394attrib: const
2395w: 1, 2, 3, 4
2396t: f16
2397ret: #2#1
2398# TODO Need range(10e-10,10e10) here similar to the float version?
2399arg: #2#1 v
2400test: none
2401end:
2402
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002403function: native_log1p
2404version: 21
2405attrib: const
2406w: 1, 2, 3, 4
2407t: f32
2408ret: #2#1
2409arg: #2#1 v
2410summary: Approximate natural logarithm of a value plus 1
2411description:
2412 Returns the approximate natural logarithm of (v + 1.0f)
2413
2414 See also @log1p().
2415end:
2416
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002417function: native_log1p
2418version: UNRELEASED
2419attrib: const
2420w: 1, 2, 3, 4
2421t: f16
2422ret: #2#1
2423arg: #2#1 v
2424test: none
2425end:
2426
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002427function: native_log2
2428version: 18
2429attrib: const
2430w: 1, 2, 3, 4
2431t: f32
2432ret: #2#1
2433arg: #2#1 v, range(10e-10,10e10)
2434summary: Approximate base 2 logarithm
2435description:
2436 Fast approximate log2.
2437
2438 It is not accurate for values very close to zero.
2439
2440 See also @log2().
2441test: limited
2442end:
2443
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002444function: native_log2
2445version: UNRELEASED
2446attrib: const
2447w: 1, 2, 3, 4
2448t: f16
2449ret: #2#1
2450# TODO Need range(10e-10,10e10) here similar to the float version?
2451arg: #2#1 v
2452test: none
2453end:
2454
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002455function: native_powr
2456version: 18
2457attrib: const
2458w: 1, 2, 3, 4
2459t: f32
2460ret: #2#1
2461arg: #2#1 base, range(0,256), "Must be between 0.f and 256.f. The function is not accurate for values very close to zero."
2462arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
2463summary: Approximate positive base raised to an exponent
2464description:
2465 Fast approximate (base ^ exponent).
2466
2467 See also @powr().
2468test: limited
2469end:
2470
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002471function: native_powr
2472version: UNRELEASED
2473attrib: const
2474w: 1, 2, 3, 4
2475t: f16
2476ret: #2#1
2477# TODO Need range(0, 256) here similar to the float version?
2478arg: #2#1 base
2479# TODO Need range(-15,15) here similar to the float version?
2480arg: #2#1 exponent
2481test: none
2482end:
2483
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002484function: native_recip
2485version: 21
2486attrib: const
2487w: 1, 2, 3, 4
2488t: f32
2489ret: #2#1
2490arg: #2#1 v
2491summary: Approximate reciprocal
2492description:
2493 Returns the approximate approximate reciprocal of a value.
2494
2495 See also @half_recip().
2496end:
2497
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002498function: native_recip
2499version: UNRELEASED
2500attrib: const
2501w: 1, 2, 3, 4
2502t: f16
2503ret: #2#1
2504arg: #2#1 v
2505test: none
2506end:
2507
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002508function: native_rootn
2509version: 21
2510attrib: const
2511w: 1, 2, 3, 4
2512t: f32
2513ret: #2#1
2514arg: #2#1 v
2515arg: int#1 n
2516summary: Approximate nth root
2517description:
2518 Compute the approximate Nth root of a value.
2519
2520 See also @rootn().
2521end:
2522
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002523function: native_rootn
2524version: UNRELEASED
2525attrib: const
2526w: 1, 2, 3, 4
2527t: f16
2528ret: #2#1
2529arg: #2#1 v
2530arg: int#1 n
2531test: none
2532end:
2533
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002534function: native_rsqrt
2535version: 21
2536attrib: const
2537w: 1, 2, 3, 4
2538t: f32
2539ret: #2#1
2540arg: #2#1 v
2541summary: Approximate reciprocal of a square root
2542description:
2543 Returns approximate (1 / sqrt(v)).
2544
2545 See also @rsqrt(), @half_rsqrt().
2546end:
2547
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002548function: native_rsqrt
2549version: UNRELEASED
2550attrib: const
2551w: 1, 2, 3, 4
2552t: f16
2553ret: #2#1
2554arg: #2#1 v
2555test: none
2556end:
2557
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002558function: native_sin
2559version: 21
2560attrib: const
2561w: 1, 2, 3, 4
2562t: f32
2563ret: #2#1
2564arg: #2#1 v
2565summary: Approximate sine
2566description:
2567 Returns the approximate sine of an angle measured in radians.
2568
2569 See also @sin().
2570end:
2571
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002572function: native_sin
2573version: UNRELEASED
2574attrib: const
2575w: 1, 2, 3, 4
2576t: f16
2577ret: #2#1
2578arg: #2#1 v
2579test: none
2580end:
2581
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002582function: native_sincos
2583version: 21
2584w: 1, 2, 3, 4
2585t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002586ret: #2#1, "Sine."
2587arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002588arg: #2#1* cos, "*cos will be set to the cosine value."
2589summary: Approximate sine and cosine
2590description:
2591 Returns the approximate sine and cosine of a value.
2592
2593 See also @sincos().
2594# TODO Temporary
2595test: limited(0.0005)
2596end:
2597
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002598function: native_sincos
2599version: UNRELEASED
2600w: 1, 2, 3, 4
2601t: f16
2602ret: #2#1
2603arg: #2#1 v
2604arg: #2#1* cos
2605test: none
2606end:
2607
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002608function: native_sinh
2609version: 21
2610attrib: const
2611w: 1, 2, 3, 4
2612t: f32
2613ret: #2#1
2614arg: #2#1 v
2615summary: Approximate hyperbolic sine
2616description:
2617 Returns the approximate hyperbolic sine of a value specified in radians.
2618
2619 See also @sinh().
2620end:
2621
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002622function: native_sinh
2623version: UNRELEASED
2624attrib: const
2625w: 1, 2, 3, 4
2626t: f16
2627ret: #2#1
2628arg: #2#1 v
2629test: none
2630end:
2631
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002632function: native_sinpi
2633version: 21
2634attrib: const
2635w: 1, 2, 3, 4
2636t: f32
2637ret: #2#1
2638arg: #2#1 v
2639summary: Approximate sine of a number multiplied by pi
2640description:
2641 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
2642
2643 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
2644
2645 See also @sinpi().
2646end:
2647
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002648function: native_sinpi
2649version: UNRELEASED
2650attrib: const
2651w: 1, 2, 3, 4
2652t: f16
2653ret: #2#1
2654arg: #2#1 v
2655test: none
2656end:
2657
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002658function: native_sqrt
2659version: 21
2660attrib: const
2661w: 1, 2, 3, 4
2662t: f32
2663ret: #2#1
2664arg: #2#1 v
2665summary: Approximate square root
2666description:
2667 Returns the approximate sqrt(v).
2668
2669 See also @sqrt(), @half_sqrt().
2670end:
2671
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002672function: native_sqrt
2673version: UNRELEASED
2674attrib: const
2675w: 1, 2, 3, 4
2676t: f16
2677ret: #2#1
2678arg: #2#1 v
2679test: none
2680end:
2681
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002682function: native_tan
2683version: 21
2684attrib: const
2685w: 1, 2, 3, 4
2686t: f32
2687ret: #2#1
2688arg: #2#1 v
2689summary: Approximate tangent
2690description:
2691 Returns the approximate tangent of an angle measured in radians.
2692end:
2693
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002694function: native_tan
2695version: UNRELEASED
2696attrib: const
2697w: 1, 2, 3, 4
2698t: f16
2699ret: #2#1
2700arg: #2#1 v
2701test: none
2702end:
2703
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002704function: native_tanh
2705version: 21
2706attrib: const
2707w: 1, 2, 3, 4
2708t: f32
2709ret: #2#1
2710arg: #2#1 v
2711summary: Approximate hyperbolic tangent
2712description:
2713 Returns the approximate hyperbolic tangent of a value.
2714
2715 See also @tanh().
2716end:
2717
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002718function: native_tanh
2719version: UNRELEASED
2720attrib: const
2721w: 1, 2, 3, 4
2722t: f16
2723ret: #2#1
2724arg: #2#1 v
2725test: none
2726end:
2727
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002728function: native_tanpi
2729version: 21
2730attrib: const
2731w: 1, 2, 3, 4
2732t: f32
2733ret: #2#1
2734arg: #2#1 v
2735summary: Approximate tangent of a number multiplied by pi
2736description:
2737 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
2738
2739 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
2740
2741 See also @tanpi().
2742end:
2743
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002744function: native_tanpi
2745version: UNRELEASED
2746attrib: const
2747w: 1, 2, 3, 4
2748t: f16
2749ret: #2#1
2750arg: #2#1 v
2751test: none
2752end:
2753
2754# TODO add f16 nextafter
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002755function: nextafter
2756version: 9
2757attrib: const
2758w: 1, 2, 3, 4
2759t: f32
2760ret: #2#1
2761arg: #2#1 v
2762arg: #2#1 target
2763summary: Next floating point number
2764description:
2765 Returns the next representable floating point number from v towards target.
2766
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002767 In rs_fp_relaxed mode, a denormalized input value may not yield the next denormalized
2768 value, as support of denormalized values is optional in relaxed mode.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002769end:
2770
2771function: pow
2772version: 9
2773attrib: const
2774w: 1, 2, 3, 4
2775t: f32
2776ret: #2#1
2777arg: #2#1 base
2778arg: #2#1 exponent
2779summary: Base raised to an exponent
2780description:
2781 Returns base raised to the power exponent, i.e. base ^ exponent.
2782
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002783 @pown() and @powr() are similar. @pown() takes an integer exponent. @powr() assumes the
2784 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002785end:
2786
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002787function: pow
2788version: UNRELEASED
2789attrib: const
2790w: 1, 2, 3, 4
2791t: f16
2792ret: #2#1
2793arg: #2#1 base
2794arg: #2#1 exponent
2795test: none
2796end:
2797
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002798function: pown
2799version: 9
2800attrib: const
2801w: 1, 2, 3, 4
2802t: f32
2803ret: #2#1
2804arg: #2#1 base
2805arg: int#1 exponent
2806summary: Base raised to an integer exponent
2807description:
2808 Returns base raised to the power exponent, i.e. base ^ exponent.
2809
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002810 @pow() and @powr() are similar. The both take a float exponent. @powr() also assumes the
2811 base to be non-negative.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002812end:
2813
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002814function: pown
2815version: UNRELEASED
2816attrib: const
2817w: 1, 2, 3, 4
2818t: f16
2819ret: #2#1
2820arg: #2#1 base
2821arg: int#1 exponent
2822test: none
2823end:
2824
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002825function: powr
2826version: 9
2827attrib: const
2828w: 1, 2, 3, 4
2829t: f32
2830ret: #2#1
2831arg: #2#1 base, range(0,3000)
2832arg: #2#1 exponent
2833summary: Positive base raised to an exponent
2834description:
2835 Returns base raised to the power exponent, i.e. base ^ exponent. base must be &gt;= 0.
2836
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002837 @pow() and @pown() are similar. They both make no assumptions about the base.
2838 @pow() takes a float exponent while @pown() take an integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002839
2840 See also @native_powr().
2841end:
2842
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002843function: powr
2844version: UNRELEASED
2845attrib: const
2846w: 1, 2, 3, 4
2847t: f16
2848ret: #2#1
2849# TODO Need range(0,3000) here similar to the float version?
2850arg: #2#1 base
2851arg: #2#1 exponent
2852test: none
2853end:
2854
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002855function: radians
2856version: 9
2857attrib: const
2858w: 1, 2, 3, 4
2859t: f32
2860ret: #2#1
2861arg: #2#1 v
2862summary: Converts degrees into radians
2863description:
2864 Converts from degrees to radians.
2865end:
2866
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002867function: radians
2868version: UNRELEASED
2869attrib: const
2870w: 1, 2, 3, 4
2871t: f16
2872ret: #2#1
2873arg: #2#1 v
2874test: none
2875end:
2876
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002877function: remainder
2878version: 9
2879attrib: const
2880w: 1, 2, 3, 4
2881t: f32
2882ret: #2#1
2883arg: #2#1 numerator
2884arg: #2#1 denominator
2885summary: Remainder of a division
2886description:
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002887 Returns the remainder of (numerator / denominator), where the quotient is rounded towards
2888 the nearest integer.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002889
2890 The function @fmod() is similar but rounds toward the closest interger.
2891 For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
2892 while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
2893end:
2894
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002895function: remainder
2896version: UNRELEASED
2897attrib: const
2898w: 1, 2, 3, 4
2899t: f16
2900ret: #2#1
2901arg: #2#1 numerator
2902arg: #2#1 denominator
2903test: none
2904end:
2905
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002906function: remquo
2907version: 9
2908w: 1, 2, 3, 4
2909t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002910ret: #2#1, "Remainder, precise only for the low three bits."
2911arg: #2#1 numerator, "Numerator."
2912arg: #2#1 denominator, "Denominator."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002913arg: int#1* quotient, "*quotient will be set to the integer quotient."
2914summary: Remainder and quotient of a division
2915description:
2916 Returns the quotient and the remainder of (numerator / denominator).
2917
2918 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
2919
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002920 This function is useful for implementing periodic functions. The low three bits of the
2921 quotient gives the quadrant and the remainder the distance within the quadrant.
2922 For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &amp;quadrant)</code>
2923 to reduce very large value of x to something within a limited range.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002924
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002925 Example: <code>remquo(-23.5f, 8.f, &amp;quot)</code> sets the lowest three bits of quot to 3
2926 and the sign negative. It returns 0.5f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002927test: custom
2928end:
2929
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002930function: remquo
2931version: UNRELEASED
2932w: 1, 2, 3, 4
2933t: f16
2934ret: #2#1
2935arg: #2#1 numerator
2936arg: #2#1 denominator
2937arg: int#1* quotient
2938test: none
2939end:
2940
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002941function: rint
2942version: 9
2943attrib: const
2944w: 1, 2, 3, 4
2945t: f32
2946ret: #2#1
2947arg: #2#1 v
2948summary: Round to even
2949description:
2950 Rounds to the nearest integral value.
2951
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07002952 rint() rounds half values to even. For example, <code>rint(0.5f)</code> returns 0.f and
2953 <code>rint(1.5f)</code> returns 2.f. Similarly, <code>rint(-0.5f)</code> returns -0.f and
2954 <code>rint(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002955
2956 @round() is similar but rounds away from zero. @trunc() truncates the decimal fraction.
2957end:
2958
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002959function: rint
2960version: UNRELEASED
2961attrib: const
2962w: 1, 2, 3, 4
2963t: f16
2964ret: #2#1
2965arg: #2#1 v
2966test: none
2967end:
2968
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002969function: rootn
2970version: 9
2971attrib: const
2972w: 1, 2, 3, 4
2973t: f32
2974ret: #2#1
2975arg: #2#1 v
2976arg: int#1 n
2977summary: Nth root
2978description:
2979 Compute the Nth root of a value.
2980
2981 See also @native_rootn().
2982end:
2983
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08002984function: rootn
2985version: UNRELEASED
2986attrib: const
2987w: 1, 2, 3, 4
2988t: f16
2989ret: #2#1
2990arg: #2#1 v
2991arg: int#1 n
2992test: none
2993end:
2994
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07002995function: round
2996version: 9
2997attrib: const
2998w: 1, 2, 3, 4
2999t: f32
3000ret: #2#1
3001arg: #2#1 v
3002summary: Round away from zero
3003description:
3004 Round to the nearest integral value.
3005
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003006 round() rounds half values away from zero. For example, <code>round(0.5f)</code> returns 1.f
3007 and <code>round(1.5f)</code> returns 2.f. Similarly, <code>round(-0.5f)</code> returns -1.f
3008 and <code>round(-1.5f)</code> returns -2.f.
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003009
3010 @rint() is similar but rounds half values toward even. @trunc() truncates the decimal fraction.
3011end:
3012
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003013function: round
3014version: UNRELEASED
3015attrib: const
3016w: 1, 2, 3, 4
3017t: f16
3018ret: #2#1
3019arg: #2#1 v
3020test: none
3021end:
3022
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003023function: rsqrt
3024version: 9
3025attrib: const
3026w: 1, 2, 3, 4
3027t: f32
3028ret: #2#1
3029arg: #2#1 v
3030summary: Reciprocal of a square root
3031description:
3032 Returns (1 / sqrt(v)).
3033
3034 See also @half_rsqrt(), @native_rsqrt().
3035end:
3036
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003037function: rsqrt
3038version: UNRELEASED
3039attrib: const
3040w: 1, 2, 3, 4
3041t: f16
3042ret: #2#1
3043arg: #2#1 v
3044test: none
3045end:
3046
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003047function: sign
3048version: 9
3049attrib: const
3050w: 1, 2, 3, 4
3051t: f32
3052ret: #2#1
3053arg: #2#1 v
3054summary: Sign of a value
3055description:
3056 Returns the sign of a value.
3057
3058 if (v &lt; 0) return -1.f;
3059 else if (v &gt; 0) return 1.f;
3060 else return 0.f;
3061end:
3062
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003063function: sign
3064version:UNRELEASED
3065attrib: const
3066w: 1, 2, 3, 4
3067t: f16
3068ret: #2#1
3069arg: #2#1 v
3070test: none
3071end:
3072
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003073function: sin
3074version: 9
3075attrib: const
3076w: 1, 2, 3, 4
3077t: f32
3078ret: #2#1
3079arg: #2#1 v
3080summary: Sine
3081description:
3082 Returns the sine of an angle measured in radians.
3083
3084 See also @native_sin().
3085end:
3086
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003087function: sin
3088version: UNRELEASED
3089attrib: const
3090w: 1, 2, 3, 4
3091t: f16
3092ret: #2#1
3093arg: #2#1 v
3094test: none
3095end:
3096
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003097function: sincos
3098version: 9
3099w: 1, 2, 3, 4
3100t: f32
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003101ret: #2#1, "Sine of v."
3102arg: #2#1 v, "Incoming value in radians."
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003103arg: #2#1* cos, "*cos will be set to the cosine value."
3104summary: Sine and cosine
3105description:
3106 Returns the sine and cosine of a value.
3107
3108 See also @native_sincos().
3109end:
3110
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003111function: sincos
3112version: UNRELEASED
3113w: 1, 2, 3, 4
3114t: f16
3115ret: #2#1
3116arg: #2#1 v
3117arg: #2#1* cos
3118test: none
3119end:
3120
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003121function: sinh
3122version: 9
3123attrib: const
3124w: 1, 2, 3, 4
3125t: f32
3126ret: #2#1
3127arg: #2#1 v
3128summary: Hyperbolic sine
3129description:
3130 Returns the hyperbolic sine of v, where v is measured in radians.
3131
3132 See also @native_sinh().
3133end:
3134
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003135function: sinh
3136version: UNRELEASED
3137attrib: const
3138w: 1, 2, 3, 4
3139t: f16
3140ret: #2#1
3141arg: #2#1 v
3142test: none
3143end:
3144
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003145function: sinpi
3146version: 9
3147attrib: const
3148w: 1, 2, 3, 4
3149t: f32
3150ret: #2#1
3151arg: #2#1 v
3152summary: Sine of a number multiplied by pi
3153description:
3154 Returns the sine of (v * pi), where (v * pi) is measured in radians.
3155
3156 To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
3157
3158 See also @native_sinpi().
3159end:
3160
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003161function: sinpi
3162version: UNRELEASED
3163attrib: const
3164w: 1, 2, 3, 4
3165t: f16
3166ret: #2#1
3167arg: #2#1 v
3168test: none
3169end:
3170
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003171function: sqrt
3172version: 9
3173attrib: const
3174w: 1, 2, 3, 4
3175t: f32
3176ret: #2#1
3177arg: #2#1 v
3178summary: Square root
3179description:
3180 Returns the square root of a value.
3181
3182 See also @half_sqrt(), @native_sqrt().
3183end:
3184
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003185function: sqrt
3186version: UNRELEASED
3187attrib: const
3188w: 1, 2, 3, 4
3189t: f16
3190ret: #2#1
3191arg: #2#1 v
3192test: none
3193end:
3194
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003195function: step
3196version: 9
3197attrib: const
3198w: 1, 2, 3, 4
3199t: f32
3200ret: #2#1
3201arg: #2#1 edge
3202arg: #2#1 v
3203summary: 0 if less than a value, 0 otherwise
3204description:
3205 Returns 0.f if v &lt; edge, 1.f otherwise.
3206
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003207 This can be useful to create conditional computations without using loops and branching
3208 instructions. For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code>
3209 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 -07003210end:
3211
3212function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003213version: UNRELEASED
3214attrib: const
3215w: 1, 2, 3, 4
3216t: f16
3217ret: #2#1
3218arg: #2#1 edge
3219arg: #2#1 v
3220test: none
3221end:
3222
3223function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003224version: 9
3225attrib: const
3226w: 2, 3, 4
3227t: f32
3228ret: #2#1
3229arg: #2#1 edge
3230arg: #2 v
3231end:
3232
3233function: step
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003234version: UNRELEASED
3235attrib: const
3236w: 2, 3, 4
3237t: f16
3238ret: #2#1
3239arg: #2#1 edge
3240arg: #2 v
3241test: none
3242end:
3243
3244function: step
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003245version: 21
3246attrib: const
3247w: 2, 3, 4
3248t: f32
3249ret: #2#1
3250arg: #2 edge
3251arg: #2#1 v
3252end:
3253
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003254function: step
3255version: UNRELEASED
3256attrib: const
3257w: 2, 3, 4
3258t: f16
3259ret: #2#1
3260arg: #2 edge
3261arg: #2#1 v
3262test: none
3263end:
3264
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003265function: tan
3266version: 9
3267attrib: const
3268w: 1, 2, 3, 4
3269t: f32
3270ret: #2#1
3271arg: #2#1 v
3272summary: Tangent
3273description:
3274 Returns the tangent of an angle measured in radians.
3275
3276 See also @native_tan().
3277end:
3278
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003279function: tan
3280version: UNRELEASED
3281attrib: const
3282w: 1, 2, 3, 4
3283t: f16
3284ret: #2#1
3285arg: #2#1 v
3286test: none
3287end:
3288
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003289function: tanh
3290version: 9
3291attrib: const
3292w: 1, 2, 3, 4
3293t: f32
3294ret: #2#1
3295arg: #2#1 v
3296summary: Hyperbolic tangent
3297description:
3298 Returns the hyperbolic tangent of a value.
3299
3300 See also @native_tanh().
3301end:
3302
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003303function: tanh
3304version: UNRELEASED
3305attrib: const
3306w: 1, 2, 3, 4
3307t: f16
3308ret: #2#1
3309arg: #2#1 v
3310test: none
3311end:
3312
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003313function: tanpi
3314version: 9
3315attrib: const
3316w: 1, 2, 3, 4
3317t: f32
3318ret: #2#1
3319arg: #2#1 v
3320summary: Tangent of a number multiplied by pi
3321description:
3322 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
3323
3324 To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
3325
3326 See also @native_tanpi().
3327end:
3328
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003329function: tanpi
3330version: UNRELEASED
3331attrib: const
3332w: 1, 2, 3, 4
3333t: f16
3334ret: #2#1
3335arg: #2#1 v
3336test: none
3337end:
3338
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003339function: tgamma
3340version: 9
3341attrib: const
3342w: 1, 2, 3, 4
3343t: f32
3344ret: #2#1
3345arg: #2#1 v
3346summary: Gamma function
3347description:
3348 Returns the gamma function of a value.
3349
3350 See also @lgamma().
3351end:
3352
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003353function: tgamma
3354version: UNRELEASED
3355attrib: const
3356w: 1, 2, 3, 4
3357t: f16
3358ret: #2#1
3359arg: #2#1 v
3360test: none
3361end:
3362
Jean-Luc Brouilletbe216382015-03-22 12:44:27 -07003363function: trunc
3364version: 9
3365attrib: const
3366w: 1, 2, 3, 4
3367t: f32
3368ret: #2#1
3369arg: #2#1 v
3370summary: Truncates a floating point
3371description:
3372 Rounds to integral using truncation.
3373
3374 For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
3375
3376 See @rint() and @round() for other rounding options.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003377end:
3378
Pirama Arumuga Nainar193847b2015-12-09 15:54:35 -08003379function: trunc
3380version: UNRELEASED
3381attrib: const
3382w: 1, 2, 3, 4
3383t: f16
3384ret: #2#1
3385arg: #2#1 v
3386test: none
3387end:
3388
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003389function: rsClamp
Verena Beckhama4d25bc2015-11-12 14:20:31 +00003390attrib: const
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003391t: i8, i16, i32, u8, u16, u32
3392ret: #1
Jean-Luc Brouillet6386ceb2015-04-28 15:06:30 -07003393arg: #1 amount, "Value to clamp."
3394arg: #1 low, "Lower bound."
3395arg: #1 high, "Upper bound."
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003396deprecated: 22, Use @clamp() instead.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003397summary: Restrain a value to a range
3398description:
3399 Clamp a value between low and high.
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003400test: none
3401end:
3402
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003403function: rsFrac
3404attrib: const
3405ret: float
3406arg: float v
Jean-Luc Brouillet36e2be52015-04-30 14:41:24 -07003407deprecated: 22, Use @fract() instead.
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003408summary: Returns the fractional part of a float
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003409description:
3410 Returns the fractional part of a float
3411test: none
3412end:
3413
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003414function: rsRand
3415ret: int
3416arg: int max_value
Jean-Luc Brouillet20b27d62015-04-03 14:39:53 -07003417summary: Pseudo-random number
Jean-Luc Brouilletc5184e22015-03-13 13:51:24 -07003418description:
3419 Return a random value between 0 (or min_value) and max_malue.
3420test: none
3421end:
3422
3423function: rsRand
3424ret: int
3425arg: int min_value
3426arg: int max_value
3427test: none
3428end:
3429
3430function: rsRand
3431ret: float
3432arg: float max_value
3433test: none
3434end:
3435
3436function: rsRand
3437ret: float
3438arg: float min_value
3439arg: float max_value
3440test: none
3441end: