rs_core_math.spec revision 45f311cd4349d12b4f7a7fb676c25a34ac77a987
1#
2# Copyright (C) 2014 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17start:
18w: 2, 3, 4
19t: u8, u16, u32, i8, i16, i32, f32
20t: u8, u16, u32, i8, i16, i32, f32
21name: convert_#3#1
22arg: #2#1 v compatible(#3)
23ret: #3#1
24comment:
25 Component wise conversion from #2#1 to #3#1
26version: 9
27end:
28
29start:
30w: 2, 3, 4
31t: u64, i64, f64
32t: u64, i64, f64
33name: convert_#3#1
34arg: #2#1 v compatible(#3)
35ret: #3#1
36comment:
37 Component wise conversion from #2#1 to #3#1
38version: 21
39end:
40
41start:
42w: 2, 3, 4
43t: u64, i64, f64
44t: u8, u16, u32, i8, i16, i32, f32
45name: convert_#3#1
46arg: #2#1 v compatible(#3)
47ret: #3#1
48comment:
49 Component wise conversion from #2#1 to #3#1
50version: 21
51end:
52
53start:
54w: 2, 3, 4
55t: u8, u16, u32, i8, i16, i32, f32
56t: u64, i64, f64
57name: convert_#3#1
58arg: #2#1 v compatible(#3)
59ret: #3#1
60comment:
61 Component wise conversion from #2#1 to #3#1
62version: 21
63end:
64
65start:
66w: 1, 2, 3, 4
67t: f32
68name: acos
69ret: #2#1
70arg: #2#1 v range(-1,1)
71comment:
72 acos
73version: 9
74end:
75
76start:
77w: 1, 2, 3, 4
78t: f32
79name: acosh
80ret: #2#1
81arg: #2#1
82comment:
83 acosh
84version: 9
85end:
86
87start:
88w: 1, 2, 3, 4
89t: f32
90name: acospi
91ret: #2#1
92arg: #2#1 v range(-1,1)
93comment:
94 acospi
95version: 9
96end:
97
98start:
99w: 1, 2, 3, 4
100t: f32
101name: asin
102ret: #2#1
103arg: #2#1 v range(-1,1)
104comment:
105 asin
106version: 9
107end:
108
109start:
110w: 1, 2, 3, 4
111t: f32
112name: asinh
113ret: #2#1
114arg: #2#1
115comment:
116 asinh
117version: 9
118end:
119
120start:
121w: 1, 2, 3, 4
122t: f32
123name: asinpi
124ret: #2#1
125arg: #2#1 v range(-1,1)
126comment:
127 Return the inverse sine divided by PI.
128version: 9
129end:
130
131start:
132w: 1, 2, 3, 4
133t: f32
134name: atan
135ret: #2#1
136arg: #2#1 v range(-1,1)
137comment:
138 Return the inverse tangent.
139version: 9
140end:
141
142start:
143w: 1, 2, 3, 4
144t: f32
145name: atan2
146ret: #2#1
147arg: #2#1 y
148arg: #2#1 x
149comment:
150 Return the inverse tangent of y / x.
151version: 9
152end:
153
154start:
155w: 1, 2, 3, 4
156t: f32
157name: atanh
158ret: #2#1
159arg: #2#1 v range(-1,1)
160comment:
161 Return the inverse hyperbolic tangent.
162version: 9
163end:
164
165start:
166w: 1, 2, 3, 4
167t: f32
168name: atanpi
169ret: #2#1
170arg: #2#1 v range(-1,1)
171comment:
172 Return the inverse tangent divided by PI.
173version: 9
174end:
175
176start:
177w: 1, 2, 3, 4
178t: f32
179name: atan2pi
180ret: #2#1
181arg: #2#1 y
182arg: #2#1 x
183comment:
184 Return the inverse tangent of y / x, divided by PI.
185version: 9
186end:
187
188start:
189w: 1, 2, 3, 4
190t: f32
191name: cbrt
192ret: #2#1
193arg: #2#1
194comment:
195 Return the cube root.
196version: 9
197end:
198
199start:
200w: 1, 2, 3, 4
201t: f32
202name: ceil
203ret: #2#1
204arg: #2#1
205comment:
206 Return the smallest integer not less than a value.
207version: 9
208end:
209
210start:
211w: 1, 2, 3, 4
212t: f32
213name: copysign
214ret: #2#1
215arg: #2#1 x
216arg: #2#1 y
217comment:
218 Copy the sign bit from y to x.
219version: 9
220end:
221
222start:
223w: 1, 2, 3, 4
224t: f32
225name: cos
226ret: #2#1
227arg: #2#1
228comment:
229 Return the cosine.
230version: 9
231end:
232
233start:
234w: 1, 2, 3, 4
235t: f32
236name: cosh
237ret: #2#1
238arg: #2#1
239comment:
240 Return the hypebolic cosine.
241version: 9
242end:
243
244start:
245w: 1, 2, 3, 4
246t: f32
247name: cospi
248ret: #2#1
249arg: #2#1
250comment:
251 Return the cosine of the value * PI.
252version: 9
253end:
254
255start:
256w: 1, 2, 3, 4
257t: f32
258name: erfc
259ret: #2#1
260arg: #2#1
261comment:
262 Return the complementary error function.
263version: 9
264end:
265
266start:
267w: 1, 2, 3, 4
268t: f32
269name: erf
270ret: #2#1
271arg: #2#1
272comment:
273 Return the error function.
274version: 9
275end:
276
277start:
278w: 1, 2, 3, 4
279t: f32
280name: exp
281ret: #2#1
282arg: #2#1
283comment:
284 Return e ^ value.
285version: 9
286end:
287
288start:
289w: 1, 2, 3, 4
290t: f32
291name: exp2
292ret: #2#1
293arg: #2#1
294comment:
295 Return 2 ^ value.
296version: 9
297end:
298
299start:
300w: 1, 2, 3, 4
301t: f32
302name: exp10
303ret: #2#1
304arg: #2#1
305comment:
306 Return 10 ^ value.
307version: 9
308end:
309
310start:
311w: 1, 2, 3, 4
312t: f32
313name: expm1
314ret: #2#1
315arg: #2#1
316comment:
317 Return (e ^ value) - 1.
318version: 9
319end:
320
321start:
322w: 1, 2, 3, 4
323t: f32
324name: fabs
325ret: #2#1
326arg: #2#1
327comment:
328 Return the absolute value of a value.
329version: 9
330end:
331
332start:
333w: 1, 2, 3, 4
334t: f32
335name: fdim
336ret: #2#1
337arg: #2#1 a
338arg: #2#1 b
339comment:
340 Return the positive difference between two values.
341version: 9
342end:
343
344start:
345w: 1, 2, 3, 4
346t: f32
347name: floor
348ret: #2#1
349arg: #2#1
350comment:
351 Return the smallest integer not greater than a value.
352version: 9
353end:
354
355start:
356w: 1, 2, 3, 4
357t: f32
358name: fma
359ret: #2#1
360arg: #2#1 a
361arg: #2#1 b
362arg: #2#1 c
363comment:
364 Return (a * b) + c.
365version: 9
366end:
367
368start:
369w: 1, 2, 3, 4
370t: f32
371# TODO What is the difference between this and max?  Same for min.
372name: fmax
373ret: #2#1
374arg: #2#1 x
375arg: #2#1 y
376comment:
377 Return (x < y ? y : x)
378version: 9
379end:
380
381start:
382w: 2, 3, 4
383t: f32
384name: fmax
385ret: #2#1
386arg: #2#1 x
387arg: #2 y
388comment:
389 Return (x < y ? y : x)
390version: 9
391end:
392
393start:
394w: 1, 2, 3, 4
395t: f32
396name: fmin
397ret: #2#1
398arg: #2#1 x
399arg: #2#1 y
400comment:
401 Return (x > y ? y : x)
402version: 9
403end:
404
405start:
406w: 2, 3, 4
407t: f32
408name: fmin
409ret: #2#1
410arg: #2#1 x
411arg: #2 y
412comment:
413 Return (x > y ? y : x)
414version: 9
415end:
416
417start:
418w: 1, 2, 3, 4
419t: f32
420name: fmod
421ret: #2#1
422arg: #2#1 x
423arg: #2#1 y
424comment:
425 Return the remainder from x / y
426version: 9
427end:
428
429start:
430w: 1, 2, 3, 4
431t: f32
432name: fract
433ret: #2#1
434arg: #2#1 v
435arg: #2#1 *floor
436comment:
437 Return fractional part of v
438
439 @param floor  floor[0] will be set to the floor of the input value.
440version: 9
441end:
442
443start:
444w: 1, 2, 3, 4
445t: f32
446name: fract
447ret: #2#1
448arg: #2#1 v
449comment:
450 Return fractional part of v
451inline:
452    #2#1 unused;
453    return fract(v, &unused);
454version: 9
455end:
456
457start:
458w: 1, 2, 3, 4
459t: f32
460name: frexp
461ret: #2#1
462arg: #2#1 v
463arg: int#1 *iptr
464comment:
465 Return the mantissa and place the exponent into iptr[0]
466
467 @param v Supports float, float2, float3, float4.
468version: 9
469end:
470
471start:
472w: 1, 2, 3, 4
473t: f32
474name: hypot
475ret: #2#1
476arg: #2#1 x
477arg: #2#1 y
478comment:
479 Return sqrt(x*x + y*y)
480version: 9
481end:
482
483start:
484w: 1, 2, 3, 4
485t: f32
486name: ilogb
487ret: int#1
488arg: float#1
489comment:
490 Return the integer exponent of a value
491version: 9
492test: custom
493end:
494
495start:
496w: 1, 2, 3, 4
497name: ldexp
498ret: float#1
499arg: float#1 x
500arg: int#1 y
501comment:
502 Return (x * 2^y)
503
504 @param x Supports 1,2,3,4 components
505 @param y Supports single component or matching vector.
506version: 9
507end:
508
509start:
510w: 2, 3, 4
511name: ldexp
512ret: float#1
513arg: float#1 x
514arg: int y
515comment:
516 Return (x * 2^y)
517
518 @param x Supports 1,2,3,4 components
519 @param y Supports single component or matching vector.
520version: 9
521end:
522
523start:
524w: 1, 2, 3, 4
525t: f32
526name: lgamma
527ret: #2#1
528arg: #2#1
529comment:
530 Return the log gamma and sign
531version: 9
532end:
533
534start:
535w: 1, 2, 3, 4
536t: f32
537name: lgamma
538ret: #2#1
539arg: #2#1 x
540arg: int#1 *y
541comment:
542 Return the log gamma and sign
543version: 9
544end:
545
546start:
547w: 1, 2, 3, 4
548t: f32
549name: log
550ret: #2#1
551arg: #2#1
552comment:
553 Return the natural logarithm.
554version: 9
555end:
556
557start:
558w: 1, 2, 3, 4
559t: f32
560name: log2
561ret: #2#1
562arg: #2#1
563comment:
564 Return the base 2 logarithm.
565version: 9
566end:
567
568start:
569w: 1, 2, 3, 4
570t: f32
571name: log10
572ret: #2#1
573arg: #2#1
574comment:
575 Return the base 10 logarithm.
576version: 9
577end:
578
579start:
580w: 1, 2, 3, 4
581t: f32
582name: log1p
583ret: #2#1
584arg: #2#1
585comment:
586 Return the natural logarithm of (v + 1.0f)
587version: 9
588end:
589
590start:
591w: 1, 2, 3, 4
592t: f32
593name: logb
594ret: #2#1
595arg: #2#1
596comment:
597 Compute the exponent of the value.
598version: 9
599end:
600
601start:
602w: 1, 2, 3, 4
603t: f32
604name: mad
605ret: #2#1
606arg: #2#1 a
607arg: #2#1 b
608arg: #2#1 c
609comment:
610 Compute (a * b) + c
611version: 9
612end:
613
614start:
615w: 1, 2, 3, 4
616t: f32
617name: modf
618ret: #2#1
619arg: #2#1 x
620arg: #2#1 *iret
621comment:
622 Return the integral and fractional components of a number.
623
624 @param x Source value
625 @param iret iret[0] will be set to the integral portion of the number.
626 @return The floating point portion of the value.
627version: 9
628end:
629
630start:
631w: 1
632t: f32
633name: nan
634ret: #2#1
635arg: uint#1
636comment:
637 generate a nan
638version: 9
639end:
640
641start:
642w: 1, 2, 3, 4
643t: f32
644name: nextafter
645ret: #2#1
646arg: #2#1 x
647arg: #2#1 y
648comment:
649 Return the next floating point number from x towards y.
650version: 9
651end:
652
653start:
654w: 1, 2, 3, 4
655t: f32
656name: pow
657ret: #2#1
658arg: #2#1 x
659arg: #2#1 y
660comment:
661 Return x ^ y.
662version: 9
663end:
664
665start:
666w: 1, 2, 3, 4
667t: f32
668name: pown
669ret: #2#1
670arg: #2#1 x
671arg: int#1 y
672comment:
673 Return x ^ y.
674version: 9
675end:
676
677start:
678w: 1, 2, 3, 4
679t: f32
680name: powr
681ret: #2#1
682arg: #2#1 x range(0,3000)
683arg: #2#1 y
684comment:
685 Return x ^ y.
686 x must be >= 0
687version: 9
688end:
689
690start:
691w: 1, 2, 3, 4
692t: f32
693name: remainder
694ret: #2#1
695arg: #2#1 x
696arg: #2#1 y
697comment:
698 Return round x/y to the nearest integer then compute the remainder.
699version: 9
700end:
701
702start:
703w: 1, 2, 3, 4
704t: f32
705name: remquo
706ret: #2#1
707arg: #2#1 b
708arg: #2#1 c
709arg: int#1 *d
710comment:
711 Return the quotient and the remainder of b/c.  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
712version: 9
713test: custom
714end:
715
716start:
717w: 1, 2, 3, 4
718t: f32
719name: rint
720ret: #2#1
721arg: #2#1
722comment:
723 Round to the nearest integral value.
724version: 9
725end:
726
727start:
728w: 1, 2, 3, 4
729t: f32
730name: rootn
731ret: #2#1
732arg: #2#1 v
733arg: int#1 n
734comment:
735 Compute the Nth root of a value.
736version: 9
737end:
738
739start:
740w: 1, 2, 3, 4
741t: f32
742name: round
743ret: #2#1
744arg: #2#1
745comment:
746 Round to the nearest integral value.  Half values are rounded away from zero.
747version: 9
748end:
749
750start:
751w: 1, 2, 3, 4
752t: f32
753name: rsqrt
754ret: #2#1
755arg: #2#1
756comment:
757 Return (1 / sqrt(value)).
758version: 9
759end:
760
761start:
762w: 1, 2, 3, 4
763t: f32
764name: sqrt
765ret: #2#1
766arg: #2#1
767comment:
768 Return the square root of a value.
769version: 9
770end:
771
772start:
773w: 1, 2, 3, 4
774t: f32
775name: sin
776ret: #2#1
777arg: #2#1
778comment:
779 Return the sine of a value specified in radians.
780version: 9
781end:
782
783start:
784w: 1, 2, 3, 4
785t: f32
786name: sincos
787ret: #2#1
788arg: #2#1 v
789arg: #2#1 *cosptr
790comment:
791 Return the sine and cosine of a value.
792
793 @return sine
794 @param v The incoming value in radians
795 @param *cosptr cosptr[0] will be set to the cosine value.
796version: 9
797end:
798
799start:
800w: 1, 2, 3, 4
801t: f32
802name: sinh
803ret: #2#1
804arg: #2#1
805comment:
806 Return the hyperbolic sine of a value specified in radians.
807version: 9
808end:
809
810start:
811w: 1, 2, 3, 4
812t: f32
813name: sinpi
814ret: #2#1
815arg: #2#1
816comment:
817 Return the sin(v * PI).
818version: 9
819end:
820
821start:
822w: 1, 2, 3, 4
823t: f32
824name: tan
825ret: #2#1
826arg: #2#1
827comment:
828 Return the tangent of a value.
829version: 9
830end:
831
832start:
833w: 1, 2, 3, 4
834t: f32
835name: tanh
836ret: #2#1
837arg: #2#1
838comment:
839 Return the hyperbolic tangent of a value.
840version: 9
841end:
842
843start:
844w: 1, 2, 3, 4
845t: f32
846name: tanpi
847ret: #2#1
848arg: #2#1
849comment:
850 Return tan(v * PI)
851version: 9
852end:
853
854start:
855w: 1, 2, 3, 4
856t: f32
857name: tgamma
858ret: #2#1
859arg: #2#1
860comment:
861 Compute the gamma function of a value.
862version: 9
863end:
864
865start:
866w: 1, 2, 3, 4
867t: f32
868name: trunc
869ret: #2#1
870arg: #2#1
871comment:
872 ound to integral using truncation.
873version: 9
874end:
875
876# int functions
877
878start:
879w: 1, 2, 3, 4
880t: i8, i16, i32
881name: abs
882ret: u#2#1
883arg: #2#1 value
884comment:
885 Return the absolute value of a value.
886version: 9
887end:
888
889start:
890w: 1, 2, 3, 4
891t: u8, u16, u32, i8, i16, i32
892name: clz
893ret: #2#1
894arg: #2#1 value
895comment:
896 Return the number of leading 0-bits in a value.
897version: 9
898end:
899
900start:
901w: 1, 2, 3, 4
902t: f32
903name: min
904ret: #2#1
905arg: #2#1
906arg: #2#1
907comment:
908 Return the minimum value from two arguments
909version: 9
910end:
911
912start:
913w: 1
914t: i8 i16 i32 u8 u16 u32
915name: min
916ret: #2#1
917arg: #2#1 v1
918arg: #2#1 v2
919comment:
920 Return the minimum value from two arguments
921inline:
922 return (v1 < v2 ? v1 : v2);
923version: 9 19
924end:
925
926start:
927w: 2
928t: i8 i16 i32 u8 u16 u32
929name: min
930ret: #2#1
931arg: #2#1 v1
932arg: #2#1 v2
933comment:
934 Return the minimum value from two arguments
935inline:
936 #2#1 tmp;
937 tmp.x = (v1.x < v2.x ? v1.x : v2.x);
938 tmp.y = (v1.y < v2.y ? v1.y : v2.y);
939 return tmp;
940version: 9 19
941end:
942
943start:
944w: 3
945t: i8 i16 i32 u8 u16 u32
946name: min
947ret: #2#1
948arg: #2#1 v1
949arg: #2#1 v2
950comment:
951 Return the minimum value from two arguments
952inline:
953 #2#1 tmp;
954 tmp.x = (v1.x < v2.x ? v1.x : v2.x);
955 tmp.y = (v1.y < v2.y ? v1.y : v2.y);
956 tmp.z = (v1.z < v2.z ? v1.z : v2.z);
957 return tmp;
958version: 9 19
959end:
960
961start:
962w: 4
963t: i8 i16 i32 u8 u16 u32
964name: min
965ret: #2#1
966arg: #2#1 v1
967arg: #2#1 v2
968comment:
969 Return the minimum value from two arguments
970inline:
971 #2#1 tmp;
972 tmp.x = (v1.x < v2.x ? v1.x : v2.x);
973 tmp.y = (v1.y < v2.y ? v1.y : v2.y);
974 tmp.z = (v1.z < v2.z ? v1.z : v2.z);
975 tmp.w = (v1.w < v2.w ? v1.w : v2.w);
976 return tmp;
977version: 9 19
978end:
979
980start:
981w: 1, 2, 3, 4
982t: i8 i16 i32 i64 u8 u16 u32 u64
983name: min
984ret: #2#1
985arg: #2#1 v1
986arg: #2#1 v2
987comment:
988 Return the minimum value from two arguments
989version: 21
990end:
991
992start:
993w: 1, 2, 3, 4
994t: f32
995name: max
996ret: #2#1
997arg: #2#1
998arg: #2#1
999comment:
1000 Return the maximum value from two arguments
1001version: 9
1002end:
1003
1004start:
1005w: 1
1006t: i8 i16 i32 u8 u16 u32
1007name: max
1008ret: #2#1
1009arg: #2#1 v1
1010arg: #2#1 v2
1011comment:
1012 Return the maximum value from two arguments
1013inline:
1014 return (v1 > v2 ? v1 : v2);
1015version: 9 19
1016end:
1017
1018start:
1019w: 2
1020t: i8 i16 i32 u8 u16 u32
1021name: max
1022ret: #2#1
1023arg: #2#1 v1
1024arg: #2#1 v2
1025comment:
1026 Return the maximum value from two arguments
1027inline:
1028 #2#1 tmp;
1029 tmp.x = (v1.x > v2.x ? v1.x : v2.x);
1030 tmp.y = (v1.y > v2.y ? v1.y : v2.y);
1031 return tmp;
1032version: 9 19
1033end:
1034
1035start:
1036w: 3
1037t: i8 i16 i32 u8 u16 u32
1038name: max
1039ret: #2#1
1040arg: #2#1 v1
1041arg: #2#1 v2
1042comment:
1043 Return the maximum value from two arguments
1044inline:
1045 #2#1 tmp;
1046 tmp.x = (v1.x > v2.x ? v1.x : v2.x);
1047 tmp.y = (v1.y > v2.y ? v1.y : v2.y);
1048 tmp.z = (v1.z > v2.z ? v1.z : v2.z);
1049 return tmp;
1050version: 9 19
1051end:
1052
1053start:
1054w: 4
1055t: i8 i16 i32 u8 u16 u32
1056name: max
1057ret: #2#1
1058arg: #2#1 v1
1059arg: #2#1 v2
1060comment:
1061 Return the maximum value from two arguments
1062inline:
1063 #2#1 tmp;
1064 tmp.x = (v1.x > v2.x ? v1.x : v2.x);
1065 tmp.y = (v1.y > v2.y ? v1.y : v2.y);
1066 tmp.z = (v1.z > v2.z ? v1.z : v2.z);
1067 tmp.w = (v1.w > v2.w ? v1.w : v2.w);
1068 return tmp;
1069version: 9 19
1070end:
1071
1072start:
1073w: 1, 2, 3, 4
1074t: i8 i16 i32 i64 u8 u16 u32 u64
1075name: max
1076ret: #2#1
1077arg: #2#1 v1
1078arg: #2#1 v2
1079comment:
1080 Return the maximum value from two arguments
1081version: 21
1082end:
1083
1084start:
1085w: 1, 2, 3, 4
1086t: f32
1087name: clamp
1088ret: #2#1
1089arg: #2#1 value
1090arg: #2#1 min_value
1091arg: #2#1 max_value above(min_value)
1092comment:
1093 Clamp a value to a specified high and low bound.
1094
1095 @param amount value to be clamped.  Supports 1,2,3,4 components
1096 @param min_value Lower bound, must be scalar or matching vector.
1097 @param max_value High bound, must match type of low
1098version: 9
1099end:
1100
1101start:
1102w: 2, 3, 4
1103t: f32
1104name: clamp
1105ret: #2#1
1106arg: #2#1 value
1107arg: #2 min_value
1108arg: #2 max_value above(min_value)
1109comment:
1110 Clamp a value to a specified high and low bound.
1111
1112 @param amount value to be clamped.  Supports 1,2,3,4 components
1113 @param min_value Lower bound, must be scalar or matching vector.
1114 @param max_value High bound, must match type of low
1115version: 9
1116end:
1117
1118start:
1119w: 1, 2, 3, 4
1120t: u8, u16, u32, u64, i8, i16, i32, i64
1121name: clamp
1122ret: #2#1
1123arg: #2#1 value
1124arg: #2#1 min_value
1125arg: #2#1 max_value above(min_value)
1126comment:
1127 Clamp a value to a specified high and low bound.
1128
1129 @param amount value to be clamped.  Supports 1,2,3,4 components
1130 @param min_value Lower bound, must be scalar or matching vector.
1131 @param max_value High bound, must match type of low
1132version: 19
1133end:
1134
1135start:
1136w: 2, 3, 4
1137t: u8, u16, u32, u64, i8, i16, i32, i64
1138name: clamp
1139ret: #2#1
1140arg: #2#1 value
1141arg: #2 min_value
1142arg: #2 max_value above(min_value)
1143comment:
1144 Clamp a value to a specified high and low bound.
1145
1146 @param amount value to be clamped.  Supports 1,2,3,4 components
1147 @param min_value Lower bound, must be scalar or matching vector.
1148 @param max_value High bound, must match type of low
1149version: 19
1150end:
1151
1152start:
1153w: 1, 2, 3, 4
1154t: f32
1155name: degrees
1156ret: #2#1
1157arg: #2#1 value
1158comment:
1159 Convert from radians to degrees.
1160version: 9
1161end:
1162
1163start:
1164w: 1, 2, 3, 4
1165t: f32
1166name: mix
1167ret: #2#1
1168arg: #2#1 start
1169arg: #2#1 stop
1170arg: #2#1 amount
1171comment:
1172 return start + ((stop - start) * amount)
1173version: 9
1174end:
1175
1176start:
1177w: 2, 3, 4
1178t: f32
1179name: mix
1180ret: #2#1
1181arg: #2#1 start
1182arg: #2#1 stop
1183arg: #2 amount
1184comment:
1185 return start + ((stop - start) * amount)
1186version: 9
1187end:
1188
1189start:
1190w: 1, 2, 3, 4
1191t: f32
1192name: radians
1193ret: #2#1
1194arg: #2#1 value
1195comment:
1196 Convert from degrees to radians.
1197version: 9
1198end:
1199
1200start:
1201w: 1, 2, 3, 4
1202t: f32
1203name: step
1204ret: #2#1
1205arg: #2#1 edge
1206arg: #2#1 v
1207comment:
1208 if (v < edge)
1209     return 0.f;
1210 else
1211     return 1.f;
1212version: 9
1213end:
1214
1215start:
1216w: 2, 3, 4
1217t: f32
1218name: step
1219ret: #2#1
1220arg: #2#1 edge
1221arg: #2 v
1222comment:
1223 if (v < edge)
1224     return 0.f;
1225 else
1226     return 1.f;
1227version: 9
1228end:
1229
1230start:
1231w: 2, 3, 4
1232t: f32
1233name: step
1234ret: #2#1
1235arg: #2 edge
1236arg: #2#1 v
1237comment:
1238 if (v < edge)
1239     return 0.f;
1240 else
1241     return 1.f;
1242version: 21
1243end:
1244
1245start:
1246w: 1, 2, 3, 4
1247t: f32
1248name: sign
1249ret: #2#1
1250arg: #2#1 v
1251comment:
1252 Return the sign of a value.
1253
1254 if (v < 0) return -1.f;
1255 else if (v > 0) return 1.f;
1256 else return 0.f;
1257version: 9
1258end:
1259
1260start:
1261w: 3, 4
1262t: f32
1263name: cross
1264ret: #2#1
1265arg: #2#1 lhs
1266arg: #2#1 rhs
1267comment:
1268 Compute the cross product of two vectors.
1269version: 9
1270test: vector
1271end:
1272
1273start:
1274w: 1, 2, 3, 4
1275t: f32
1276name: dot
1277ret: #2
1278arg: #2#1 lhs
1279arg: #2#1 rhs
1280comment:
1281 Compute the dot product of two vectors.
1282version: 9
1283test: vector
1284end:
1285
1286start:
1287w: 1, 2, 3, 4
1288t: f32
1289name: length
1290ret: #2
1291arg: #2#1 v
1292comment:
1293 Compute the length of a vector.
1294version: 9
1295test: vector
1296end:
1297
1298start:
1299w: 1, 2, 3, 4
1300t: f32
1301name: distance
1302ret: #2
1303arg: #2#1 lhs
1304arg: #2#1 rhs
1305comment:
1306 Compute the distance between two points.
1307version: 9
1308test: vector
1309end:
1310
1311start:
1312w: 1, 2, 3, 4
1313t: f32
1314name: normalize
1315ret: #2#1
1316arg: #2#1 v
1317comment:
1318 Normalize a vector.
1319version: 9
1320test: vector
1321end:
1322
1323start:
1324w: 1, 2, 3, 4
1325t: f32
1326name: half_recip
1327ret: #2#1
1328arg: #2#1 v
1329comment:
1330 Return the approximate reciprocal of a value.
1331version: 17
1332end:
1333
1334start:
1335w: 1, 2, 3, 4
1336t: f32
1337name: half_sqrt
1338ret: #2#1
1339arg: #2#1 v
1340comment:
1341 Return the approximate square root of a value.
1342version: 17
1343end:
1344
1345start:
1346w: 1, 2, 3, 4
1347t: f32
1348name: half_rsqrt
1349ret: #2#1
1350arg: #2#1 v
1351comment:
1352 Return the approximate value of (1.f / sqrt(value)).
1353version: 17
1354end:
1355
1356start:
1357w: 1, 2, 3, 4
1358t: f32
1359name: fast_length
1360ret: #2
1361arg: #2#1 v
1362comment:
1363 Compute the approximate length of a vector.
1364version: 17
1365test: vector
1366end:
1367
1368start:
1369w: 1, 2, 3, 4
1370t: f32
1371name: fast_distance
1372ret: #2
1373arg: #2#1 lhs
1374arg: #2#1 rhs
1375comment:
1376 Compute the approximate distance between two points.
1377version: 17
1378test: vector
1379end:
1380
1381start:
1382w: 1, 2, 3, 4
1383t: f32
1384name: fast_normalize
1385ret: #2#1
1386arg: #2#1 v
1387comment:
1388 Approximately normalize a vector.
1389version: 17
1390test: vector
1391end:
1392
1393start:
1394w: 1, 2, 3, 4
1395t: f32
1396name: native_exp
1397ret: #2#1
1398arg: #2#1 v range(-86,86)
1399comment:
1400 Fast approximate exp
1401 valid for inputs -86.f to 86.f
1402 Max 8192 ulps of error
1403version: 18
1404test: limited
1405end:
1406
1407start:
1408w: 1, 2, 3, 4
1409t: f32
1410name: native_exp2
1411ret: #2#1
1412arg: #2#1 v range(-125,125)
1413comment:
1414 Fast approximate exp2
1415 valid for inputs -125.f to 125.f
1416 Max 8192 ulps of error
1417version: 18
1418test: limited
1419end:
1420
1421start:
1422w: 1, 2, 3, 4
1423t: f32
1424name: native_exp10
1425ret: #2#1
1426arg: #2#1 v range(-37,37)
1427comment:
1428 Fast approximate exp10
1429 valid for inputs -37.f to 37.f
1430 Max 8192 ulps of error
1431version: 18
1432test: limited
1433end:
1434
1435start:
1436w: 1, 2, 3, 4
1437t: f32
1438name: native_log
1439ret: #2#1
1440arg: #2#1 v range(10e-10,10e10)
1441comment:
1442 Fast approximate log
1443 It is not accurate for values very close to zero.
1444version: 18
1445test: limited
1446end:
1447
1448start:
1449w: 1, 2, 3, 4
1450t: f32
1451name: native_log2
1452ret: #2#1
1453arg: #2#1 v range(10e-10,10e10)
1454comment:
1455 Fast approximate log2
1456 It is not accurate for values very close to zero.
1457version: 18
1458test: limited
1459end:
1460
1461start:
1462w: 1, 2, 3, 4
1463t: f32
1464name: native_log10
1465ret: #2#1
1466arg: #2#1 v range(10e-10,10e10)
1467comment:
1468 Fast approximate log10
1469 It is not accurate for values very close to zero.
1470version: 18
1471test: limited
1472end:
1473
1474start:
1475w: 1, 2, 3, 4
1476t: f32
1477name: native_powr
1478ret: #2#1
1479arg: #2#1 v range(0,256)
1480arg: #2#1 y range(-15,15)
1481comment:
1482 Fast approximate v ^ y
1483 v must be between 0.f and 256.f
1484 y must be between -15.f and 15.f
1485 It is not accurate for values of v very close to zero.
1486version: 18
1487test: limited
1488end:
1489
1490
1491start:
1492w: 1, 2, 3, 4
1493t: f32
1494name: native_acos
1495ret: #2#1
1496arg: #2#1 v range(-1,1)
1497comment:
1498 acos
1499version: 21
1500# TODO Temporary
1501test: limited(0.0005)
1502end:
1503
1504start:
1505w: 1, 2, 3, 4
1506t: f32
1507name: native_acosh
1508ret: #2#1
1509arg: #2#1
1510comment:
1511 acosh
1512version: 21
1513# TODO Temporary
1514test: limited(0.0005)
1515end:
1516
1517start:
1518w: 1, 2, 3, 4
1519t: f32
1520name: native_acospi
1521ret: #2#1
1522arg: #2#1 v range(-1,1)
1523comment:
1524 acospi
1525version: 21
1526# TODO Temporary
1527test: limited(0.0005)
1528end:
1529
1530start:
1531w: 1, 2, 3, 4
1532t: f32
1533name: native_asin
1534ret: #2#1
1535arg: #2#1 v range(-1,1)
1536comment:
1537 asin
1538version: 21
1539# TODO Temporary
1540test: limited(0.0005)
1541end:
1542
1543start:
1544w: 1, 2, 3, 4
1545t: f32
1546name: native_asinh
1547ret: #2#1
1548arg: #2#1
1549comment:
1550 asinh
1551version: 21
1552# TODO Temporary
1553test: limited(0.0005)
1554end:
1555
1556start:
1557w: 1, 2, 3, 4
1558t: f32
1559name: native_asinpi
1560ret: #2#1
1561arg: #2#1 v range(-1,1)
1562comment:
1563 Return the inverse sine divided by PI.
1564version: 21
1565# TODO Temporary
1566test: limited(0.0005)
1567end:
1568
1569start:
1570w: 1, 2, 3, 4
1571t: f32
1572name: native_atan
1573ret: #2#1
1574arg: #2#1 v range(-1,1)
1575comment:
1576 Return the inverse tangent.
1577version: 21
1578# TODO Temporary
1579test: limited(0.0005)
1580end:
1581
1582start:
1583w: 1, 2, 3, 4
1584t: f32
1585name: native_atan2
1586ret: #2#1
1587arg: #2#1 y
1588arg: #2#1 x
1589comment:
1590 Return the inverse tangent of y / x.
1591version: 21
1592# TODO Temporary
1593test: limited(0.0005)
1594end:
1595
1596start:
1597w: 1, 2, 3, 4
1598t: f32
1599name: native_atanh
1600ret: #2#1
1601arg: #2#1 in range(-1,1)
1602comment:
1603 Return the inverse hyperbolic tangent.
1604version: 21
1605# TODO Temporary
1606test: limited(0.0005)
1607end:
1608
1609start:
1610w: 1, 2, 3, 4
1611t: f32
1612name: native_atanpi
1613ret: #2#1
1614arg: #2#1 v range(-1,1)
1615comment:
1616 Return the inverse tangent divided by PI.
1617version: 21
1618# TODO Temporary
1619test: limited(0.0005)
1620end:
1621
1622start:
1623w: 1, 2, 3, 4
1624t: f32
1625name: native_atan2pi
1626ret: #2#1
1627arg: #2#1 y
1628arg: #2#1 x
1629comment:
1630 Return the inverse tangent of y / x, divided by PI.
1631version: 21
1632# TODO Temporary
1633test: limited(0.0005)
1634end:
1635
1636start:
1637w: 1, 2, 3, 4
1638t: f32
1639name: native_cbrt
1640ret: #2#1
1641arg: #2#1
1642comment:
1643 Return the cube root.
1644version: 21
1645end:
1646
1647start:
1648w: 1, 2, 3, 4
1649t: f32
1650name: native_cos
1651ret: #2#1
1652arg: #2#1
1653comment:
1654 Return the cosine.
1655version: 21
1656end:
1657
1658start:
1659w: 1, 2, 3, 4
1660t: f32
1661name: native_cosh
1662ret: #2#1
1663arg: #2#1
1664comment:
1665 Return the hypebolic cosine.
1666version: 21
1667end:
1668
1669start:
1670w: 1, 2, 3, 4
1671t: f32
1672name: native_cospi
1673ret: #2#1
1674arg: #2#1
1675comment:
1676 Return the cosine of the value * PI.
1677version: 21
1678end:
1679
1680start:
1681w: 1, 2, 3, 4
1682t: f32
1683name: native_expm1
1684ret: #2#1
1685arg: #2#1
1686comment:
1687 Return (e ^ value) - 1.
1688version: 21
1689end:
1690
1691start:
1692w: 1, 2, 3, 4
1693t: f32
1694name: native_distance
1695ret: #2
1696arg: #2#1 lhs
1697arg: #2#1 rhs
1698comment:
1699 Compute the approximate distance between two points.
1700version: 21
1701test: vector
1702end:
1703
1704start:
1705w: 1, 2, 3, 4
1706t: f32
1707name: native_divide
1708ret: #2#1
1709arg: #2#1 lhs
1710arg: #2#1 rhs
1711comment:
1712 Compute the approximate division result of two values.
1713version: 21
1714end:
1715
1716start:
1717w: 1, 2, 3, 4
1718t: f32
1719name: native_hypot
1720ret: #2#1
1721arg: #2#1 x
1722arg: #2#1 y
1723comment:
1724 Return native_sqrt(x*x + y*y)
1725version: 21
1726end:
1727
1728start:
1729w: 1, 2, 3, 4
1730t: f32
1731name: native_normalize
1732ret: #2#1
1733arg: #2#1 v
1734comment:
1735 Normalize a vector.
1736version: 21
1737test: vector
1738end:
1739
1740start:
1741w: 1, 2, 3, 4
1742t: f32
1743name: native_length
1744ret: #2
1745arg: #2#1 v
1746comment:
1747 Compute the approximate length of a vector.
1748version: 21
1749test: vector
1750end:
1751
1752start:
1753w: 1, 2, 3, 4
1754t: f32
1755name: native_log1p
1756ret: #2#1
1757arg: #2#1
1758comment:
1759 Return the natural logarithm of (v + 1.0f)
1760version: 21
1761end:
1762
1763start:
1764w: 1, 2, 3, 4
1765t: f32
1766name: native_recip
1767ret: #2#1
1768arg: #2#1 v
1769comment:
1770 Return the approximate reciprocal of a value.
1771version: 21
1772end:
1773
1774start:
1775w: 1, 2, 3, 4
1776t: f32
1777name: native_rootn
1778ret: #2#1
1779arg: #2#1 v
1780arg: int#1 n
1781comment:
1782 Compute the Nth root of a value.
1783version: 21
1784end:
1785
1786start:
1787w: 1, 2, 3, 4
1788t: f32
1789name: native_rsqrt
1790ret: #2#1
1791arg: #2#1
1792comment:
1793 Return (1 / sqrt(value)).
1794version: 21
1795end:
1796
1797start:
1798w: 1, 2, 3, 4
1799t: f32
1800name: native_sin
1801ret: #2#1
1802arg: #2#1
1803comment:
1804 Return the sine of a value specified in radians.
1805version: 21
1806end:
1807
1808start:
1809w: 1, 2, 3, 4
1810t: f32
1811name: native_sincos
1812ret: #2#1
1813arg: #2#1 v
1814arg: #2#1 *cosptr
1815comment:
1816 Return the sine and cosine of a value.
1817
1818 @return sine
1819 @param v The incoming value in radians
1820 @param *cosptr cosptr[0] will be set to the cosine value.
1821version: 21
1822# TODO Temporary
1823test: limited(0.0005)
1824end:
1825
1826start:
1827w: 1, 2, 3, 4
1828t: f32
1829name: native_sinh
1830ret: #2#1
1831arg: #2#1
1832comment:
1833 Return the hyperbolic sine of a value specified in radians.
1834version: 21
1835end:
1836
1837start:
1838w: 1, 2, 3, 4
1839t: f32
1840name: native_sinpi
1841ret: #2#1
1842arg: #2#1
1843comment:
1844 Return the sin(v * PI).
1845version: 21
1846end:
1847
1848start:
1849w: 1, 2, 3, 4
1850t: f32
1851name: native_sqrt
1852ret: #2#1
1853arg: #2#1
1854comment:
1855 Return the aproximate sqrt(v).
1856version: 21
1857end:
1858
1859start:
1860w: 1, 2, 3, 4
1861t: f32
1862name: native_tan
1863ret: #2#1
1864arg: #2#1
1865comment:
1866 Return the tangent of a value.
1867version: 21
1868end:
1869
1870start:
1871w: 1, 2, 3, 4
1872t: f32
1873name: native_tanh
1874ret: #2#1
1875arg: #2#1
1876comment:
1877 Return the hyperbolic tangent of a value.
1878version: 21
1879end:
1880
1881start:
1882w: 1, 2, 3, 4
1883t: f32
1884name: native_tanpi
1885ret: #2#1
1886arg: #2#1
1887comment:
1888 Return tan(v * PI)
1889version: 21
1890end:
1891
1892
1893