blob: 3b0b601eaf6d7d22c65168e1c6bbeb2ca5ee54e5 [file] [log] [blame]
Jason Sams135c4b72013-12-11 18:24:45 -08001#
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -08002# Copyright (C) 2014 The Android Open Source Project
Jason Sams135c4b72013-12-11 18:24:45 -08003#
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:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -080018w: 1, 2, 3, 4
19t: i8, i16, i32
20name: abs
21ret: u#2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -080022arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -080023comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -080024 Returns the absolute value of an integer.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080025
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -080026 For floats, use fabs().
Jason Sams135c4b72013-12-11 18:24:45 -080027version: 9
28end:
29
30start:
31w: 1, 2, 3, 4
32t: f32
33name: acos
34ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -080035arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -080036comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080037 Returns the inverse cosine, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -080038version: 9
39end:
40
41start:
42w: 1, 2, 3, 4
43t: f32
44name: acosh
45ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -080046arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -080047comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080048 Returns the inverse hyperbolic cosine, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -080049version: 9
50end:
51
52start:
53w: 1, 2, 3, 4
54t: f32
55name: acospi
56ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -080057arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -080058comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080059 Returns the inverse cosine in radians, divided by pi.
60
61 To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
Jason Sams135c4b72013-12-11 18:24:45 -080062version: 9
63end:
64
65start:
66w: 1, 2, 3, 4
67t: f32
68name: asin
69ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -080070arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -080071comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080072 Returns the inverse sine, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -080073version: 9
74end:
75
76start:
77w: 1, 2, 3, 4
78t: f32
79name: asinh
80ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -080081arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -080082comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080083 Returns the inverse hyperbolic sine, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -080084version: 9
85end:
86
87start:
88w: 1, 2, 3, 4
89t: f32
90name: asinpi
91ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -080092arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -080093comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -080094 Returns the inverse sine in radians, divided by pi.
95
96 To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
Jason Sams135c4b72013-12-11 18:24:45 -080097version: 9
98end:
99
100start:
101w: 1, 2, 3, 4
102t: f32
103name: atan
104ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -0800105arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -0800106comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800107 Returns the inverse tangent, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -0800108version: 9
109end:
110
111start:
112w: 1, 2, 3, 4
113t: f32
114name: atan2
115ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800116arg: #2#1 numerator
117arg: #2#1 denominator
Jason Sams135c4b72013-12-11 18:24:45 -0800118comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800119 Returns the inverse tangent of (numerator / denominator), in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800120
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800121 denominator can be 0.
Jason Sams135c4b72013-12-11 18:24:45 -0800122version: 9
123end:
124
125start:
126w: 1, 2, 3, 4
127t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800128name: atan2pi
129ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800130arg: #2#1 numerator
131arg: #2#1 denominator
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800132comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800133 Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800134
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800135 To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800136
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800137 denominator can be 0.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800138version: 9
139end:
140
141start:
142w: 1, 2, 3, 4
143t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800144name: atanh
145ret: #2#1
Jean-Luc Brouillet32c18182014-07-29 13:52:45 -0700146arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -0800147comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800148 Returns the inverse hyperbolic tangent, in radians.
Jason Sams135c4b72013-12-11 18:24:45 -0800149version: 9
150end:
151
152start:
153w: 1, 2, 3, 4
154t: f32
155name: atanpi
156ret: #2#1
Jean-Luc Brouilletbcd5b9a2014-03-07 18:00:57 -0800157arg: #2#1 v range(-1,1)
Jason Sams135c4b72013-12-11 18:24:45 -0800158comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800159 Returns the inverse tangent in radians, divided by pi.
160
161 To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
Jason Sams135c4b72013-12-11 18:24:45 -0800162version: 9
163end:
164
165start:
166w: 1, 2, 3, 4
167t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800168name: cbrt
169ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800170arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800171comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800172 Returns the cube root.
Jason Sams135c4b72013-12-11 18:24:45 -0800173version: 9
174end:
175
176start:
177w: 1, 2, 3, 4
178t: f32
179name: ceil
180ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800181arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800182comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800183 Returns the smallest integer not less than a value.
184
185 For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
Jason Sams135c4b72013-12-11 18:24:45 -0800186version: 9
187end:
188
189start:
190w: 1, 2, 3, 4
191t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800192name: clamp
193ret: #2#1
194arg: #2#1 value
195arg: #2#1 min_value
196arg: #2#1 max_value above(min_value)
197comment:
198 Clamps a value to a specified high and low bound.
199
200 clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
201
202 If min_value is greater than max_value, the results are undefined.
203
204 @param value Value to be clamped. Supports 1, 2, 3, 4 components.
205 @param min_value Lower bound, must be scalar or matching vector.
206 @param max_value High bound, must match the type of low.
207version: 9
208end:
209
210start:
211w: 2, 3, 4
212t: f32
213name: clamp
214ret: #2#1
215arg: #2#1 value
216arg: #2 min_value
217arg: #2 max_value above(min_value)
218comment:
219 Clamps a value to a specified high and low bound.
220
221 clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
222
223 If min_value is greater than max_value, the results are undefined.
224
225 @param value Value to be clamped. Supports 1, 2, 3, 4 components.
226 @param min_value Lower bound, must be scalar or matching vector.
227 @param max_value High bound, must match the type of low.
228version: 9
229end:
230
231start:
232w: 1, 2, 3, 4
233t: u8, u16, u32, u64, i8, i16, i32, i64
234name: clamp
235ret: #2#1
236arg: #2#1 value
237arg: #2#1 min_value
238arg: #2#1 max_value above(min_value)
239comment:
240 Clamps a value to a specified high and low bound.
241
242 clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
243
244 If min_value is greater than max_value, the results are undefined.
245
246 @param value Value to be clamped. Supports 1, 2, 3, 4 components.
247 @param min_value Lower bound, must be scalar or matching vector.
248 @param max_value High bound, must match the type of low.
249version: 19
250end:
251
252start:
253w: 2, 3, 4
254t: u8, u16, u32, u64, i8, i16, i32, i64
255name: clamp
256ret: #2#1
257arg: #2#1 value
258arg: #2 min_value
259arg: #2 max_value above(min_value)
260comment:
261 Clamps a value to a specified high and low bound.
262
263 clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
264
265 If min_value is greater than max_value, the results are undefined.
266
267 @param value Value to be clamped. Supports 1, 2, 3, 4 components.
268 @param min_value Lower bound, must be scalar or matching vector.
269 @param max_value High bound, must match the type of low.
270version: 19
271end:
272
273start:
274w: 1, 2, 3, 4
275t: u8, u16, u32, i8, i16, i32
276name: clz
277ret: #2#1
278arg: #2#1 value
279comment:
280 Returns the number of leading 0-bits in a value.
281
282 For example, clz((char)0x03) returns 5.
283version: 9
284end:
285
286start:
287w: 2, 3, 4
288t: u8, u16, u32, i8, i16, i32, f32
289t: u8, u16, u32, i8, i16, i32, f32
290name: convert_#3#1
291arg: #2#1 v compatible(#3)
292ret: #3#1
293comment:
294 Component wise conversion from #2#1 to #3#1.
295
296 For the convert_* functions, conversions of floating point values to integer will truncate.
297 Conversions of numbers too large to fit the destination type yield undefined results.
298 For example, converting a float that contains 1.0e18 to a short is undefined.
299version: 9
300end:
301
302start:
303w: 2, 3, 4
304t: u64, i64, f64
305t: u64, i64, f64
306name: convert_#3#1
307arg: #2#1 v compatible(#3)
308ret: #3#1
309comment:
310 Component wise conversion from #2#1 to #3#1.
311
312 For the convert_* functions, conversions of floating point values to integer will truncate.
313 Conversions of numbers too large to fit the destination type yield undefined results.
314 For example, converting a float that contains 1.0e18 to a short is undefined.
315version: 21
316end:
317
318start:
319w: 2, 3, 4
320t: u64, i64, f64
321t: u8, u16, u32, i8, i16, i32, f32
322name: convert_#3#1
323arg: #2#1 v compatible(#3)
324ret: #3#1
325comment:
326 Component wise conversion from #2#1 to #3#1.
327
328 For the convert_* functions, conversions of floating point values to integer will truncate.
329 Conversions of numbers too large to fit the destination type yield undefined results.
330 For example, converting a float that contains 1.0e18 to a short is undefined.
331version: 21
332end:
333
334start:
335w: 2, 3, 4
336t: u8, u16, u32, i8, i16, i32, f32
337t: u64, i64, f64
338name: convert_#3#1
339arg: #2#1 v compatible(#3)
340ret: #3#1
341comment:
342 Component wise conversion from #2#1 to #3#1.
343
344 For the convert_* functions, conversions of floating point values to integer will truncate.
345 Conversions of numbers too large to fit the destination type yield undefined results.
346 For example, converting a float that contains 1.0e18 to a short is undefined.
347version: 21
348end:
349
350start:
351w: 1, 2, 3, 4
352t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800353name: copysign
354ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800355arg: #2#1 magnitude_value
356arg: #2#1 sign_value
Jason Sams135c4b72013-12-11 18:24:45 -0800357comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800358 Copies the sign from sign_value to magnitude_value.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800359
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800360 The value returned is either magnitude_value or -magnitude_value.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800361
362 For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
Jason Sams135c4b72013-12-11 18:24:45 -0800363version: 9
364end:
365
366start:
367w: 1, 2, 3, 4
368t: f32
369name: cos
370ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800371arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800372comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800373 Returns the cosine of an angle measured in radians.
Jason Sams135c4b72013-12-11 18:24:45 -0800374version: 9
375end:
376
377start:
378w: 1, 2, 3, 4
379t: f32
380name: cosh
381ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800382arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800383comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800384 Returns the hypebolic cosine of v, where v is measured in radians.
Jason Sams135c4b72013-12-11 18:24:45 -0800385version: 9
386end:
387
388start:
389w: 1, 2, 3, 4
390t: f32
391name: cospi
392ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800393arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800394comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800395 Returns the cosine of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800396
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800397 To get the cosine of a value measured in degrees, call cospi(v / 180.f).
Jason Sams135c4b72013-12-11 18:24:45 -0800398version: 9
399end:
400
401start:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800402w: 3, 4
403t: f32
404name: cross
405ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800406arg: #2#1 left_vector
407arg: #2#1 right_vector
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800408comment:
409 Computes the cross product of two vectors.
410version: 9
411test: vector
412end:
413
414start:
Jason Sams135c4b72013-12-11 18:24:45 -0800415w: 1, 2, 3, 4
416t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800417name: degrees
Jason Sams135c4b72013-12-11 18:24:45 -0800418ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800419arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800420comment:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800421 Converts from radians to degrees.
Jason Sams135c4b72013-12-11 18:24:45 -0800422version: 9
423end:
424
425start:
426w: 1, 2, 3, 4
427t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800428name: distance
429ret: #2
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800430arg: #2#1 left_vector
431arg: #2#1 right_vector
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800432comment:
433 Compute the distance between two points.
434version: 9
435test: vector
436end:
437
438start:
439w: 1, 2, 3, 4
440t: f32
441name: dot
442ret: #2
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800443arg: #2#1 left_vector
444arg: #2#1 right_vector
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800445comment:
446 Computes the dot product of two vectors.
447version: 9
448test: vector
449end:
450
451start:
452w: 1, 2, 3, 4
453t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800454name: erf
455ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800456arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800457comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800458 Returns the error function.
Jason Sams135c4b72013-12-11 18:24:45 -0800459version: 9
460end:
461
462start:
463w: 1, 2, 3, 4
464t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800465name: erfc
466ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800467arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800468comment:
469 Returns the complementary error function.
470version: 9
471end:
472
473start:
474w: 1, 2, 3, 4
475t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800476name: exp
477ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800478arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800479comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800480 Returns e raised to v, i.e. e ^ v.
Jason Sams135c4b72013-12-11 18:24:45 -0800481version: 9
482end:
483
484start:
485w: 1, 2, 3, 4
486t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800487name: exp10
Jason Sams135c4b72013-12-11 18:24:45 -0800488ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800489arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800490comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800491 Returns 10 raised to v, i.e. 10.f ^ v.
Jason Sams135c4b72013-12-11 18:24:45 -0800492version: 9
493end:
494
495start:
496w: 1, 2, 3, 4
497t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800498name: exp2
Jason Sams135c4b72013-12-11 18:24:45 -0800499ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800500arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800501comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800502 Returns 2 raised to v, i.e. 2.f ^ v.
Jason Sams135c4b72013-12-11 18:24:45 -0800503version: 9
504end:
505
506start:
507w: 1, 2, 3, 4
508t: f32
509name: expm1
510ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800511arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800512comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800513 Returns e raised to v minus 1, i.e. (e ^ v) - 1.
Jason Sams135c4b72013-12-11 18:24:45 -0800514version: 9
515end:
516
517start:
518w: 1, 2, 3, 4
519t: f32
520name: fabs
521ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800522arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800523comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800524 Returns the absolute value of the float v.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800525
526 For integers, use abs().
Jason Sams135c4b72013-12-11 18:24:45 -0800527version: 9
528end:
529
530start:
531w: 1, 2, 3, 4
532t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800533name: fast_distance
534ret: #2
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800535arg: #2#1 left_vector
536arg: #2#1 right_vector
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800537comment:
538 Computes the approximate distance between two points.
539
540 The precision is what would be expected from doing the computation using 16 bit floating point values.
541version: 17
542test: vector
543end:
544
545start:
546w: 1, 2, 3, 4
547t: f32
548name: fast_length
549ret: #2
550arg: #2#1 v
551comment:
552 Computes the approximate length of a vector.
553
554 The precision is what would be expected from doing the computation using 16 bit floating point values.
555version: 17
556test: vector
557end:
558
559start:
560w: 1, 2, 3, 4
561t: f32
562name: fast_normalize
563ret: #2#1
564arg: #2#1 v
565comment:
566 Approximately normalizes a vector.
567
568 For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
569
570 The precision is what would be expected from doing the computation using 16 bit floating point values.
571version: 17
572test: vector
573end:
574
575start:
576w: 1, 2, 3, 4
577t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800578name: fdim
579ret: #2#1
Jean-Luc Brouillet963c3672014-02-12 20:58:47 -0800580arg: #2#1 a
581arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800582comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800583 Returns the positive difference between two values.
584
585 If a > b, returns (a - b) otherwise returns 0f.
Jason Sams135c4b72013-12-11 18:24:45 -0800586version: 9
587end:
588
589start:
590w: 1, 2, 3, 4
591t: f32
592name: floor
593ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800594arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800595comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800596 Returns the smallest integer not greater than a value.
Jason Sams135c4b72013-12-11 18:24:45 -0800597version: 9
598end:
599
600start:
601w: 1, 2, 3, 4
602t: f32
603name: fma
604ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800605arg: #2#1 multiplicand1
606arg: #2#1 multiplicand2
607arg: #2#1 offset
Jason Sams135c4b72013-12-11 18:24:45 -0800608comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800609 Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800610
611 This function is identical to mad().
Jason Sams135c4b72013-12-11 18:24:45 -0800612version: 9
613end:
614
615start:
616w: 1, 2, 3, 4
617t: f32
618name: fmax
619ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800620arg: #2#1 a
621arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800622comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800623 Returns the maximum of a and b, i.e. (a < b ? b : a).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800624
625 The max() function returns identical results but can be applied to more data types.
Jason Sams135c4b72013-12-11 18:24:45 -0800626version: 9
627end:
628
629start:
Jean-Luc Brouillet43587eb2014-02-04 15:42:53 -0800630w: 2, 3, 4
Jason Sams135c4b72013-12-11 18:24:45 -0800631t: f32
632name: fmax
633ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800634arg: #2#1 a
635arg: #2 b
Jason Sams135c4b72013-12-11 18:24:45 -0800636comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800637 Returns the maximum of a and b, i.e. (a < b ? b : a).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800638
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800639 Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b.
Jason Sams135c4b72013-12-11 18:24:45 -0800640version: 9
641end:
642
643start:
644w: 1, 2, 3, 4
645t: f32
646name: fmin
647ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800648arg: #2#1 a
649arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800650comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800651 Returns the minimum of a and b, i.e. (a > b ? b : a).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800652
653 The min() function returns identical results but can be applied to more data types.
Jason Sams135c4b72013-12-11 18:24:45 -0800654version: 9
655end:
656
657start:
Jean-Luc Brouillet43587eb2014-02-04 15:42:53 -0800658w: 2, 3, 4
Jason Sams135c4b72013-12-11 18:24:45 -0800659t: f32
660name: fmin
661ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800662arg: #2#1 a
663arg: #2 b
Jason Sams135c4b72013-12-11 18:24:45 -0800664comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800665 Returns the minimum of a and b, i.e. (a > b ? b : a)
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800666
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800667 Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b.
Jason Sams135c4b72013-12-11 18:24:45 -0800668version: 9
669end:
670
671start:
672w: 1, 2, 3, 4
673t: f32
674name: fmod
675ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800676arg: #2#1 numerator
677arg: #2#1 denominator
Jason Sams135c4b72013-12-11 18:24:45 -0800678comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800679 Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800680
681 The function remainder() is similar but rounds toward the closest interger.
682 For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
683 while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
Jason Sams135c4b72013-12-11 18:24:45 -0800684version: 9
685end:
686
687start:
688w: 1, 2, 3, 4
689t: f32
690name: fract
691ret: #2#1
692arg: #2#1 v
Jean-Luc Brouillet963c3672014-02-12 20:58:47 -0800693arg: #2#1 *floor
Jason Sams135c4b72013-12-11 18:24:45 -0800694comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800695 Returns the positive fractional part of v, i.e. v - floor(v).
Jason Sams135c4b72013-12-11 18:24:45 -0800696
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800697 For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
698 fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
699
700 @param v Input value.
701 @param floor If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
Jason Sams135c4b72013-12-11 18:24:45 -0800702version: 9
703end:
704
705start:
706w: 1, 2, 3, 4
707t: f32
708name: fract
709ret: #2#1
710arg: #2#1 v
711comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800712 Returns the positive fractional part of v, i.e. v - floor(v).
713
714 For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
715 fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
Jason Sams135c4b72013-12-11 18:24:45 -0800716inline:
717 #2#1 unused;
718 return fract(v, &unused);
719version: 9
720end:
721
722start:
723w: 1, 2, 3, 4
724t: f32
725name: frexp
726ret: #2#1
727arg: #2#1 v
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800728arg: int#1 *exponent
Jason Sams135c4b72013-12-11 18:24:45 -0800729comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800730 Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
731
732 The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
733 See ldexp() for the reverse operation.
Jason Sams135c4b72013-12-11 18:24:45 -0800734
735 @param v Supports float, float2, float3, float4.
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800736 @param exponent If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
Jason Sams135c4b72013-12-11 18:24:45 -0800737version: 9
738end:
739
740start:
741w: 1, 2, 3, 4
742t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800743name: half_recip
744ret: #2#1
745arg: #2#1 v
746comment:
747 Returns the approximate reciprocal of a value.
748
749 The precision is that of a 16 bit floating point value.
750version: 17
751end:
752
753start:
754w: 1, 2, 3, 4
755t: f32
756name: half_rsqrt
757ret: #2#1
758arg: #2#1 v
759comment:
760 Returns the approximate value of (1.f / sqrt(value)).
761
762 The precision is that of a 16 bit floating point value.
763version: 17
764end:
765
766start:
767w: 1, 2, 3, 4
768t: f32
769name: half_sqrt
770ret: #2#1
771arg: #2#1 v
772comment:
773 Returns the approximate square root of a value.
774
775 The precision is that of a 16 bit floating point value.
776version: 17
777end:
778
779start:
780w: 1, 2, 3, 4
781t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800782name: hypot
783ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800784arg: #2#1 a
785arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800786comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800787 Returns the hypotenuse, i.e. sqrt(a * a + b * b).
Jason Sams135c4b72013-12-11 18:24:45 -0800788version: 9
789end:
790
791start:
792w: 1, 2, 3, 4
793t: f32
794name: ilogb
Jason Samsea877ed2014-01-09 15:48:32 -0800795ret: int#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800796arg: float#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800797comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800798 Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
799
800 For example, ilogb(8.5f) returns 3. Because of the difference in mantissa, this number is one less than
801 is returned by frexp().
802
803 logb() is similar but returns a float.
Jason Sams135c4b72013-12-11 18:24:45 -0800804version: 9
Jean-Luc Brouillet93906642014-07-23 21:25:45 -0700805test: custom
Jason Sams135c4b72013-12-11 18:24:45 -0800806end:
807
808start:
809w: 1, 2, 3, 4
Jason Samsea877ed2014-01-09 15:48:32 -0800810name: ldexp
811ret: float#1
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800812arg: float#1 mantissa
813arg: int#1 exponent
Jason Samsea877ed2014-01-09 15:48:32 -0800814comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800815 Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
Jason Samsea877ed2014-01-09 15:48:32 -0800816
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800817 See frexp() for the reverse operation.
818
819 @param mantissa Supports float, float2, float3, and float4.
820 @param exponent Supports single component or matching vector.
Jason Samsea877ed2014-01-09 15:48:32 -0800821version: 9
822end:
823
824start:
825w: 2, 3, 4
826name: ldexp
827ret: float#1
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800828arg: float#1 mantissa
829arg: int exponent
Jason Samsea877ed2014-01-09 15:48:32 -0800830comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800831 Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
832 See frexp() for the reverse operation.
Jason Samsea877ed2014-01-09 15:48:32 -0800833
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800834 @param mantissa Supports float, float2, float3, and float4.
835 @param exponent Supports single component or matching vector.
Jason Samsea877ed2014-01-09 15:48:32 -0800836version: 9
837end:
838
839start:
840w: 1, 2, 3, 4
Jason Sams135c4b72013-12-11 18:24:45 -0800841t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800842name: length
843ret: #2
844arg: #2#1 v
845comment:
846 Computes the length of a vector.
847version: 9
848test: vector
849end:
850
851start:
852w: 1, 2, 3, 4
853t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800854name: lgamma
855ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800856arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800857comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800858 Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
Jason Sams135c4b72013-12-11 18:24:45 -0800859version: 9
860end:
861
862start:
863w: 1, 2, 3, 4
864t: f32
865name: lgamma
866ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800867arg: #2#1 v
868arg: int#1 *sign_of_gamma
Jason Sams135c4b72013-12-11 18:24:45 -0800869comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800870 Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800871
872 Can also return the sign of the gamma function.
873
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800874 @param v Input value.
875 @param sign_of_gamma If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800876
Jason Sams135c4b72013-12-11 18:24:45 -0800877version: 9
Jean-Luc Brouillet631b9e32014-09-18 14:12:37 -0700878#TODO Temporary until bionic & associated drivers are fixed
879test: custom
Jason Sams135c4b72013-12-11 18:24:45 -0800880end:
881
882start:
883w: 1, 2, 3, 4
884t: f32
885name: log
886ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800887arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800888comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800889 Returns the natural logarithm.
Jason Sams135c4b72013-12-11 18:24:45 -0800890version: 9
891end:
892
893start:
894w: 1, 2, 3, 4
895t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800896name: log10
897ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800898arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800899comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800900 Returns the base 10 logarithm.
Jason Sams135c4b72013-12-11 18:24:45 -0800901version: 9
902end:
903
904start:
905w: 1, 2, 3, 4
906t: f32
907name: log1p
908ret: #2#1
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800909arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800910comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800911 Returns the natural logarithm of (v + 1.f).
Jason Sams135c4b72013-12-11 18:24:45 -0800912version: 9
913end:
914
915start:
916w: 1, 2, 3, 4
917t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800918name: log2
919ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800920arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -0800921comment:
922 Returns the base 2 logarithm.
923version: 9
924end:
925
926start:
927w: 1, 2, 3, 4
928t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800929name: logb
930ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800931arg: #2#1 v
Jason Sams135c4b72013-12-11 18:24:45 -0800932comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800933 Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
934
Stephen Hines7d6c9ba2015-01-16 16:34:28 -0800935 For example, logb(8.5f) returns 3.f. Because of the difference in mantissa, this number is one less than
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800936 is returned by frexp().
937
938 ilogb() is similar but returns an integer.
Jason Sams135c4b72013-12-11 18:24:45 -0800939version: 9
940end:
941
942start:
943w: 1, 2, 3, 4
944t: f32
945name: mad
946ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800947arg: #2#1 multiplicand1
948arg: #2#1 multiplicand2
949arg: #2#1 offset
Jason Sams135c4b72013-12-11 18:24:45 -0800950comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800951 Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -0800952
953 This function is identical to fma().
Jason Sams135c4b72013-12-11 18:24:45 -0800954version: 9
955end:
956
957start:
958w: 1, 2, 3, 4
959t: f32
Jason Sams135c4b72013-12-11 18:24:45 -0800960name: max
961ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800962arg: #2#1 a
963arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800964comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800965 Returns the maximum value of two arguments.
Jason Sams135c4b72013-12-11 18:24:45 -0800966version: 9
967end:
968
969start:
Jason Samsea877ed2014-01-09 15:48:32 -0800970w: 1
Jason Sams135c4b72013-12-11 18:24:45 -0800971t: i8 i16 i32 u8 u16 u32
972name: max
973ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800974arg: #2#1 a
975arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -0800976comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800977 Returns the maximum value of two arguments.
Jason Sams135c4b72013-12-11 18:24:45 -0800978inline:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800979 return (a > b ? a : b);
Jean-Luc Brouillet39282332015-03-03 13:17:26 -0800980version: 9 20
Jason Samsea877ed2014-01-09 15:48:32 -0800981end:
982
983start:
984w: 2
985t: i8 i16 i32 u8 u16 u32
986name: max
987ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800988arg: #2#1 a
989arg: #2#1 b
Jason Samsea877ed2014-01-09 15:48:32 -0800990comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800991 Returns the maximum value of two arguments.
Jason Samsea877ed2014-01-09 15:48:32 -0800992inline:
993 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -0800994 tmp.x = (a.x > b.x ? a.x : b.x);
995 tmp.y = (a.y > b.y ? a.y : b.y);
Jason Samsea877ed2014-01-09 15:48:32 -0800996 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -0800997version: 9 20
Jason Samsea877ed2014-01-09 15:48:32 -0800998end:
999
1000start:
1001w: 3
1002t: i8 i16 i32 u8 u16 u32
1003name: max
1004ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001005arg: #2#1 a
1006arg: #2#1 b
Jason Samsea877ed2014-01-09 15:48:32 -08001007comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001008 Returns the maximum value of two arguments.
Jason Samsea877ed2014-01-09 15:48:32 -08001009inline:
1010 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001011 tmp.x = (a.x > b.x ? a.x : b.x);
1012 tmp.y = (a.y > b.y ? a.y : b.y);
1013 tmp.z = (a.z > b.z ? a.z : b.z);
Jason Samsea877ed2014-01-09 15:48:32 -08001014 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001015version: 9 20
Jason Samsea877ed2014-01-09 15:48:32 -08001016end:
1017
1018start:
1019w: 4
1020t: i8 i16 i32 u8 u16 u32
1021name: max
1022ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001023arg: #2#1 a
1024arg: #2#1 b
Jason Samsea877ed2014-01-09 15:48:32 -08001025comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001026 Returns the maximum value of two arguments.
Jason Samsea877ed2014-01-09 15:48:32 -08001027inline:
1028 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001029 tmp.x = (a.x > b.x ? a.x : b.x);
1030 tmp.y = (a.y > b.y ? a.y : b.y);
1031 tmp.z = (a.z > b.z ? a.z : b.z);
1032 tmp.w = (a.w > b.w ? a.w : b.w);
Jason Samsea877ed2014-01-09 15:48:32 -08001033 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001034version: 9 20
Jason Sams135c4b72013-12-11 18:24:45 -08001035end:
1036
1037start:
1038w: 1, 2, 3, 4
1039t: i8 i16 i32 i64 u8 u16 u32 u64
1040name: max
1041ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001042arg: #2#1 a
1043arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -08001044comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001045 Returns the maximum value of two arguments.
Jason Samsaa456932014-08-18 16:20:51 -07001046version: 21
Jason Sams135c4b72013-12-11 18:24:45 -08001047end:
1048
1049start:
1050w: 1, 2, 3, 4
1051t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001052name: min
Jason Sams135c4b72013-12-11 18:24:45 -08001053ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001054arg: #2#1 a
1055arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -08001056comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001057 Returns the minimum value of two arguments.
Jason Sams135c4b72013-12-11 18:24:45 -08001058version: 9
1059end:
1060
1061start:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001062w: 1
1063t: i8 i16 i32 u8 u16 u32
1064name: min
Jason Sams135c4b72013-12-11 18:24:45 -08001065ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001066arg: #2#1 a
1067arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -08001068comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001069 Returns the minimum value of two arguments.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001070inline:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001071 return (a < b ? a : b);
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001072version: 9 20
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001073end:
Jason Sams135c4b72013-12-11 18:24:45 -08001074
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001075start:
1076w: 2
1077t: i8 i16 i32 u8 u16 u32
1078name: min
1079ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001080arg: #2#1 a
1081arg: #2#1 b
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001082comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001083 Returns the minimum value of two arguments.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001084inline:
1085 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001086 tmp.x = (a.x < b.x ? a.x : b.x);
1087 tmp.y = (a.y < b.y ? a.y : b.y);
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001088 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001089version: 9 20
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001090end:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001091
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001092start:
1093w: 3
1094t: i8 i16 i32 u8 u16 u32
1095name: min
1096ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001097arg: #2#1 a
1098arg: #2#1 b
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001099comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001100 Returns the minimum value of two arguments.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001101inline:
1102 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001103 tmp.x = (a.x < b.x ? a.x : b.x);
1104 tmp.y = (a.y < b.y ? a.y : b.y);
1105 tmp.z = (a.z < b.z ? a.z : b.z);
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001106 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001107version: 9 20
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001108end:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001109
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001110start:
1111w: 4
1112t: i8 i16 i32 u8 u16 u32
1113name: min
1114ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001115arg: #2#1 a
1116arg: #2#1 b
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001117comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001118 Returns the minimum value of two arguments.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001119inline:
1120 #2#1 tmp;
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001121 tmp.x = (a.x < b.x ? a.x : b.x);
1122 tmp.y = (a.y < b.y ? a.y : b.y);
1123 tmp.z = (a.z < b.z ? a.z : b.z);
1124 tmp.w = (a.w < b.w ? a.w : b.w);
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001125 return tmp;
Jean-Luc Brouillet39282332015-03-03 13:17:26 -08001126version: 9 20
Jason Sams135c4b72013-12-11 18:24:45 -08001127end:
1128
1129start:
1130w: 1, 2, 3, 4
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001131t: i8 i16 i32 i64 u8 u16 u32 u64
1132name: min
Jason Sams135c4b72013-12-11 18:24:45 -08001133ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001134arg: #2#1 a
1135arg: #2#1 b
Jason Sams135c4b72013-12-11 18:24:45 -08001136comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001137 Returns the minimum value of two arguments.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001138version: 21
Jason Sams135c4b72013-12-11 18:24:45 -08001139end:
1140
1141start:
1142w: 1, 2, 3, 4
1143t: f32
1144name: mix
1145ret: #2#1
1146arg: #2#1 start
1147arg: #2#1 stop
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001148arg: #2#1 fraction
Jason Sams135c4b72013-12-11 18:24:45 -08001149comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001150 Returns start + ((stop - start) * fraction).
1151
1152 This can be useful for mixing two values. For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
Jason Sams135c4b72013-12-11 18:24:45 -08001153version: 9
1154end:
1155
1156start:
Jean-Luc Brouillet43587eb2014-02-04 15:42:53 -08001157w: 2, 3, 4
Jason Sams135c4b72013-12-11 18:24:45 -08001158t: f32
1159name: mix
1160ret: #2#1
1161arg: #2#1 start
1162arg: #2#1 stop
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001163arg: #2 fraction
Jason Sams135c4b72013-12-11 18:24:45 -08001164comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001165 Returns start + ((stop - start) * fraction).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001166
1167 This can be useful for mixing two values. For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
Jason Sams135c4b72013-12-11 18:24:45 -08001168version: 9
1169end:
1170
1171start:
1172w: 1, 2, 3, 4
1173t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001174name: modf
Jason Sams135c4b72013-12-11 18:24:45 -08001175ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001176arg: #2#1 v
1177arg: #2#1 *integral_part
Jason Sams135c4b72013-12-11 18:24:45 -08001178comment:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001179 Returns the integral and fractional components of a number.
1180
1181 Both components will have the same sign as x. For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
1182
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001183 @param v Source value
1184 @param integral_part integral_part[0] will be set to the integral portion of the number.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001185 @return The floating point portion of the value.
Jason Sams135c4b72013-12-11 18:24:45 -08001186version: 9
1187end:
1188
1189start:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001190w: 1
Jason Sams135c4b72013-12-11 18:24:45 -08001191t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001192name: nan
Jason Sams135c4b72013-12-11 18:24:45 -08001193ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001194arg: uint#1 v
Jason Sams135c4b72013-12-11 18:24:45 -08001195comment:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001196 Returns a NaN value (Not a Number).
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001197
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001198 @param v Not used.
1199#TODO We're not using the argument. Once we do, add this documentation line:
1200# The argument is embedded into the return value and can be used to distinguish various NaNs.
Jason Sams135c4b72013-12-11 18:24:45 -08001201version: 9
1202end:
1203
1204start:
Jason Samsd2d7c182014-07-17 18:41:25 -07001205w: 1, 2, 3, 4
1206t: f32
1207name: native_acos
1208ret: #2#1
1209arg: #2#1 v range(-1,1)
1210comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001211 Returns the approximate inverse cosine, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001212version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001213# TODO Temporary
1214test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001215end:
1216
1217start:
1218w: 1, 2, 3, 4
1219t: f32
1220name: native_acosh
1221ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001222arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001223comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001224 Returns the approximate inverse hyperbolic cosine, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001225version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001226# TODO Temporary
1227test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001228end:
1229
1230start:
1231w: 1, 2, 3, 4
1232t: f32
1233name: native_acospi
1234ret: #2#1
1235arg: #2#1 v range(-1,1)
1236comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001237 Returns the approximate inverse cosine in radians, divided by pi.
1238
1239 To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
Jason Samsd2d7c182014-07-17 18:41:25 -07001240version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001241# TODO Temporary
1242test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001243end:
1244
1245start:
1246w: 1, 2, 3, 4
1247t: f32
1248name: native_asin
1249ret: #2#1
1250arg: #2#1 v range(-1,1)
1251comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001252 Returns the approximate inverse sine, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001253version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001254# TODO Temporary
1255test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001256end:
1257
1258start:
1259w: 1, 2, 3, 4
1260t: f32
1261name: native_asinh
1262ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001263arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001264comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001265 Returns the approximate inverse hyperbolic sine, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001266version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001267# TODO Temporary
1268test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001269end:
1270
1271start:
1272w: 1, 2, 3, 4
1273t: f32
1274name: native_asinpi
1275ret: #2#1
1276arg: #2#1 v range(-1,1)
1277comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001278 Returns the approximate inverse sine in radians, divided by pi.
1279
1280 To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
Jason Samsd2d7c182014-07-17 18:41:25 -07001281version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001282# TODO Temporary
1283test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001284end:
1285
1286start:
1287w: 1, 2, 3, 4
1288t: f32
1289name: native_atan
1290ret: #2#1
1291arg: #2#1 v range(-1,1)
1292comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001293 Returns the approximate inverse tangent, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001294version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001295# TODO Temporary
1296test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001297end:
1298
1299start:
1300w: 1, 2, 3, 4
1301t: f32
1302name: native_atan2
1303ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001304arg: #2#1 numerator
1305arg: #2#1 denominator
Jason Samsd2d7c182014-07-17 18:41:25 -07001306comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001307 Returns the approximate inverse tangent of numerator / denominator, in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001308
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001309 denominator can be 0.
Jason Samsd2d7c182014-07-17 18:41:25 -07001310version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001311# TODO Temporary
1312test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001313end:
1314
1315start:
1316w: 1, 2, 3, 4
1317t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001318name: native_atan2pi
1319ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001320arg: #2#1 numerator
1321arg: #2#1 denominator
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001322comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001323 Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001324
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001325 To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001326
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001327 denominator can be 0.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001328version: 21
1329# TODO Temporary
1330test: limited(0.0005)
1331end:
1332
1333start:
1334w: 1, 2, 3, 4
1335t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001336name: native_atanh
1337ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001338arg: #2#1 v range(-1,1)
Jason Samsd2d7c182014-07-17 18:41:25 -07001339comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001340 Returns the approximate inverse hyperbolic tangent, in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001341version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001342# TODO Temporary
1343test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001344end:
1345
1346start:
1347w: 1, 2, 3, 4
1348t: f32
1349name: native_atanpi
1350ret: #2#1
1351arg: #2#1 v range(-1,1)
1352comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001353 Returns the approximate inverse tangent in radians, divided by pi.
1354
1355 To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
Jason Samsd2d7c182014-07-17 18:41:25 -07001356version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001357# TODO Temporary
1358test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001359end:
1360
1361start:
1362w: 1, 2, 3, 4
1363t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001364name: native_cbrt
1365ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001366arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001367comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001368 Returns the approximate cubic root.
Jason Samsd2d7c182014-07-17 18:41:25 -07001369version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001370end:
1371
1372start:
1373w: 1, 2, 3, 4
1374t: f32
1375name: native_cos
1376ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001377arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001378comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001379 Returns the approximate cosine of an angle measured in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001380version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001381end:
1382
1383start:
1384w: 1, 2, 3, 4
1385t: f32
1386name: native_cosh
1387ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001388arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001389comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001390 Returns the approximate hypebolic cosine.
Jason Samsd2d7c182014-07-17 18:41:25 -07001391version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001392end:
1393
1394start:
1395w: 1, 2, 3, 4
1396t: f32
1397name: native_cospi
1398ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001399arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001400comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001401 Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001402
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001403 To get the cosine of a value measured in degrees, call cospi(v / 180.f).
Jason Samsd2d7c182014-07-17 18:41:25 -07001404version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001405end:
1406
1407start:
1408w: 1, 2, 3, 4
1409t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001410name: native_distance
1411ret: #2
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001412arg: #2#1 left_vector
1413arg: #2#1 right_vector
Jason Samsd2d7c182014-07-17 18:41:25 -07001414comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001415 Computes the approximate distance between two points.
Jason Samsd2d7c182014-07-17 18:41:25 -07001416version: 21
Jean-Luc Brouillet1b0707d2014-07-24 13:27:26 -07001417test: vector
Jason Samsd2d7c182014-07-17 18:41:25 -07001418end:
1419
1420start:
1421w: 1, 2, 3, 4
1422t: f32
1423name: native_divide
1424ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001425arg: #2#1 left_vector
1426arg: #2#1 right_vector
Jason Samsd2d7c182014-07-17 18:41:25 -07001427comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001428 Computes the approximate division result of two values.
Jason Samsd2d7c182014-07-17 18:41:25 -07001429version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001430end:
1431
1432start:
1433w: 1, 2, 3, 4
1434t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001435name: native_exp
1436ret: #2#1
1437arg: #2#1 v range(-86,86)
1438comment:
1439 Fast approximate exp.
1440
1441 It is valid for inputs from -86.f to 86.f. The precision is no worse than what would be expected from using 16 bit floating point values.
1442version: 18
1443test: limited
1444end:
1445
1446start:
1447w: 1, 2, 3, 4
1448t: f32
1449name: native_exp10
1450ret: #2#1
1451arg: #2#1 v range(-37,37)
1452comment:
1453 Fast approximate exp10.
1454
1455 It is valid for inputs from -37.f to 37.f. The precision is no worse than what would be expected from using 16 bit floating point values.
1456version: 18
1457test: limited
1458end:
1459
1460start:
1461w: 1, 2, 3, 4
1462t: f32
1463name: native_exp2
1464ret: #2#1
1465arg: #2#1 v range(-125,125)
1466comment:
1467 Fast approximate exp2.
1468
1469 It is valid for inputs from -125.f to 125.f. The precision is no worse than what would be expected from using 16 bit floating point values.
1470version: 18
1471test: limited
1472end:
1473
1474start:
1475w: 1, 2, 3, 4
1476t: f32
1477name: native_expm1
1478ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001479arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001480comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001481 Returns the approximate (e ^ v) - 1.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001482version: 21
1483end:
1484
1485start:
1486w: 1, 2, 3, 4
1487t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001488name: native_hypot
1489ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001490arg: #2#1 a
1491arg: #2#1 b
Jason Samsd2d7c182014-07-17 18:41:25 -07001492comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001493 Returns the approximate native_sqrt(a * a + b * b)
Jason Samsd2d7c182014-07-17 18:41:25 -07001494version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001495end:
1496
1497start:
1498w: 1, 2, 3, 4
1499t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001500name: native_length
1501ret: #2
1502arg: #2#1 v
1503comment:
1504 Compute the approximate length of a vector.
1505version: 21
1506test: vector
1507end:
1508
1509start:
1510w: 1, 2, 3, 4
1511t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001512name: native_log
1513ret: #2#1
1514arg: #2#1 v range(10e-10,10e10)
1515comment:
1516 Fast approximate log.
1517
1518 It is not accurate for values very close to zero.
1519version: 18
1520test: limited
1521end:
1522
1523start:
1524w: 1, 2, 3, 4
1525t: f32
1526name: native_log10
1527ret: #2#1
1528arg: #2#1 v range(10e-10,10e10)
1529comment:
1530 Fast approximate log10.
1531
1532 It is not accurate for values very close to zero.
1533version: 18
1534test: limited
1535end:
1536
1537start:
1538w: 1, 2, 3, 4
1539t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001540name: native_log1p
1541ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001542arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001543comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001544 Returns the approximate natural logarithm of (v + 1.0f)
Jason Samsd2d7c182014-07-17 18:41:25 -07001545version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001546end:
1547
1548start:
1549w: 1, 2, 3, 4
1550t: f32
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001551name: native_log2
1552ret: #2#1
1553arg: #2#1 v range(10e-10,10e10)
1554comment:
1555 Fast approximate log2.
1556
1557 It is not accurate for values very close to zero.
1558version: 18
1559test: limited
1560end:
1561
1562start:
1563w: 1, 2, 3, 4
1564t: f32
1565name: native_normalize
1566ret: #2#1
1567arg: #2#1 v
1568comment:
1569 Approximately normalizes a vector.
1570version: 21
1571test: vector
1572end:
1573
1574start:
1575w: 1, 2, 3, 4
1576t: f32
1577name: native_powr
1578ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001579arg: #2#1 base range(0,256)
1580arg: #2#1 exponent range(-15,15)
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001581comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001582 Fast approximate (base ^ exponent).
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001583
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001584 @param base Must be between 0.f and 256.f. The function is not accurate for values very close to zero.
1585 @param exponent Must be between -15.f and 15.f.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001586version: 18
1587test: limited
1588end:
1589
1590start:
1591w: 1, 2, 3, 4
1592t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001593name: native_recip
1594ret: #2#1
1595arg: #2#1 v
1596comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001597 Returns the approximate approximate reciprocal of a value.
Jason Samsd2d7c182014-07-17 18:41:25 -07001598version: 21
1599end:
1600
1601start:
1602w: 1, 2, 3, 4
1603t: f32
1604name: native_rootn
1605ret: #2#1
1606arg: #2#1 v
1607arg: int#1 n
1608comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001609 Compute the approximate Nth root of a value.
Jason Samsd2d7c182014-07-17 18:41:25 -07001610version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001611end:
1612
1613start:
1614w: 1, 2, 3, 4
1615t: f32
1616name: native_rsqrt
1617ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001618arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001619comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001620 Returns approximate (1 / sqrt(v)).
Jason Samsd2d7c182014-07-17 18:41:25 -07001621version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001622end:
1623
1624start:
1625w: 1, 2, 3, 4
1626t: f32
Jason Samsd2d7c182014-07-17 18:41:25 -07001627name: native_sin
1628ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001629arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001630comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001631 Returns the approximate sine of an angle measured in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001632version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001633end:
1634
1635start:
1636w: 1, 2, 3, 4
1637t: f32
1638name: native_sincos
1639ret: #2#1
1640arg: #2#1 v
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001641arg: #2#1 *cos
Jason Samsd2d7c182014-07-17 18:41:25 -07001642comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001643 Returns the approximate sine and cosine of a value.
Jason Samsd2d7c182014-07-17 18:41:25 -07001644
1645 @return sine
1646 @param v The incoming value in radians
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001647 @param *cos cos[0] will be set to the cosine value.
Jason Samsd2d7c182014-07-17 18:41:25 -07001648version: 21
Jean-Luc Brouillet45f311c2014-09-11 13:53:01 -07001649# TODO Temporary
1650test: limited(0.0005)
Jason Samsd2d7c182014-07-17 18:41:25 -07001651end:
1652
1653start:
1654w: 1, 2, 3, 4
1655t: f32
1656name: native_sinh
1657ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001658arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001659comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001660 Returns the approximate hyperbolic sine of a value specified in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001661version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001662end:
1663
1664start:
1665w: 1, 2, 3, 4
1666t: f32
1667name: native_sinpi
1668ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001669arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001670comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001671 Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001672
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001673 To get the sine of a value measured in degrees, call sinpi(v / 180.f).
Jason Samsd2d7c182014-07-17 18:41:25 -07001674version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001675end:
1676
1677start:
1678w: 1, 2, 3, 4
1679t: f32
1680name: native_sqrt
1681ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001682arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001683comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001684 Returns the approximate sqrt(v).
Jason Samsd2d7c182014-07-17 18:41:25 -07001685version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001686end:
1687
1688start:
1689w: 1, 2, 3, 4
1690t: f32
1691name: native_tan
1692ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001693arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001694comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001695 Returns the approximate tangent of an angle measured in radians.
Jason Samsd2d7c182014-07-17 18:41:25 -07001696version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001697end:
1698
1699start:
1700w: 1, 2, 3, 4
1701t: f32
1702name: native_tanh
1703ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001704arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001705comment:
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001706 Returns the approximate hyperbolic tangent of a value.
Jason Samsd2d7c182014-07-17 18:41:25 -07001707version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001708end:
1709
1710start:
1711w: 1, 2, 3, 4
1712t: f32
1713name: native_tanpi
1714ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001715arg: #2#1 v
Jason Samsd2d7c182014-07-17 18:41:25 -07001716comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001717 Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet462e62c2014-12-12 13:42:24 -08001718
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001719 To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
Jason Samsd2d7c182014-07-17 18:41:25 -07001720version: 21
Jason Samsd2d7c182014-07-17 18:41:25 -07001721end:
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001722
1723start:
1724w: 1, 2, 3, 4
1725t: f32
1726name: nextafter
1727ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001728arg: #2#1 v
1729arg: #2#1 target
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001730comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001731 Returns the next floating point number from v towards target.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001732version: 9
1733end:
1734
1735start:
1736w: 1, 2, 3, 4
1737t: f32
1738name: normalize
1739ret: #2#1
1740arg: #2#1 v
1741comment:
1742 Normalize a vector.
1743
1744 For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
1745version: 9
1746test: vector
1747end:
1748
1749start:
1750w: 1, 2, 3, 4
1751t: f32
1752name: pow
1753ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001754arg: #2#1 base
1755arg: #2#1 exponent
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001756comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001757 Returns base raised to the power exponent, i.e. base ^ exponent.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001758
1759 pown() and powr() are similar. pown() takes an integer exponent. powr() assumes the base to be non-negative.
1760version: 9
1761end:
1762
1763start:
1764w: 1, 2, 3, 4
1765t: f32
1766name: pown
1767ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001768arg: #2#1 base
1769arg: int#1 exponent
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001770comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001771 Returns base raised to the power exponent, i.e. base ^ exponent.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001772
1773 pow() and powr() are similar. The both take a float exponent. powr() also assumes the base to be non-negative.
1774version: 9
1775end:
1776
1777start:
1778w: 1, 2, 3, 4
1779t: f32
1780name: powr
1781ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001782arg: #2#1 base range(0,3000)
1783arg: #2#1 exponent
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001784comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001785 Returns base raised to the power exponent, i.e. base ^ exponent. base must be >= 0.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001786
1787 pow() and pown() are similar. They both make no assumptions about the base. pow() takes a float exponent while pown() take an integer.
1788version: 9
1789end:
1790
1791start:
1792w: 1, 2, 3, 4
1793t: f32
1794name: radians
1795ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001796arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001797comment:
1798 Converts from degrees to radians.
1799version: 9
1800end:
1801
1802start:
1803w: 1, 2, 3, 4
1804t: f32
1805name: remainder
1806ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001807arg: #2#1 numerator
1808arg: #2#1 denominator
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001809comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001810 Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001811
1812 The function fmod() is similar but rounds toward the closest interger.
1813 For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
1814 while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
1815version: 9
1816end:
1817
1818start:
1819w: 1, 2, 3, 4
1820t: f32
1821name: remquo
1822ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001823arg: #2#1 numerator
1824arg: #2#1 denominator
1825arg: int#1 *quotient
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001826comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001827 Returns the quotient and the remainder of (numerator / denominator).
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001828
1829 Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
1830
1831 This function is useful for implementing periodic functions. The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant. For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range.
1832
1833 Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative. It returns 0.5f.
1834
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001835 @param numerator The numerator.
1836 @param denominator The denominator.
1837 @param *quotient quotient[0] will be set to the integer quotient.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001838 @return The remainder, precise only for the low three bits.
1839version: 9
1840test: custom
1841end:
1842
1843start:
1844w: 1, 2, 3, 4
1845t: f32
1846name: rint
1847ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001848arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001849comment:
1850 Rounds to the nearest integral value.
1851
1852 rint() rounds half values to even. For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f. Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
1853
1854 round() is similar but rounds away from zero. trunc() truncates the decimal fraction.
1855version: 9
1856end:
1857
1858start:
1859w: 1, 2, 3, 4
1860t: f32
1861name: rootn
1862ret: #2#1
1863arg: #2#1 v
1864arg: int#1 n
1865comment:
1866 Compute the Nth root of a value.
1867version: 9
1868end:
1869
1870start:
1871w: 1, 2, 3, 4
1872t: f32
1873name: round
1874ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001875arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001876comment:
1877 Round to the nearest integral value.
1878
1879 round() rounds half values away from zero. For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f. Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
1880
1881 rint() is similar but rounds half values toward even. trunc() truncates the decimal fraction.
1882version: 9
1883end:
1884
1885start:
1886w: 1, 2, 3, 4
1887t: f32
1888name: rsqrt
1889ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001890arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001891comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001892 Returns (1 / sqrt(v)).
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001893version: 9
1894end:
1895
1896start:
1897w: 1, 2, 3, 4
1898t: f32
1899name: sign
1900ret: #2#1
1901arg: #2#1 v
1902comment:
1903 Returns the sign of a value.
1904
1905 if (v < 0) return -1.f;
1906 else if (v > 0) return 1.f;
1907 else return 0.f;
1908version: 9
1909end:
1910
1911start:
1912w: 1, 2, 3, 4
1913t: f32
1914name: sin
1915ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001916arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001917comment:
1918 Returns the sine of an angle measured in radians.
1919version: 9
1920end:
1921
1922start:
1923w: 1, 2, 3, 4
1924t: f32
1925name: sincos
1926ret: #2#1
1927arg: #2#1 v
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001928arg: #2#1 *cos
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001929comment:
1930 Returns the sine and cosine of a value.
1931
1932 @return sine of v
1933 @param v The incoming value in radians
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001934 @param *cos cosptr[0] will be set to the cosine value.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001935version: 9
1936end:
1937
1938start:
1939w: 1, 2, 3, 4
1940t: f32
1941name: sinh
1942ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001943arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001944comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001945 Returns the hyperbolic sine of v, where v is measured in radians.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001946version: 9
1947end:
1948
1949start:
1950w: 1, 2, 3, 4
1951t: f32
1952name: sinpi
1953ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001954arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001955comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001956 Returns the sine of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001957
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001958 To get the sine of a value measured in degrees, call sinpi(v / 180.f).
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001959version: 9
1960end:
1961
1962start:
1963w: 1, 2, 3, 4
1964t: f32
1965name: sqrt
1966ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08001967arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08001968comment:
1969 Returns the square root of a value.
1970version: 9
1971end:
1972
1973start:
1974w: 1, 2, 3, 4
1975t: f32
1976name: step
1977ret: #2#1
1978arg: #2#1 edge
1979arg: #2#1 v
1980comment:
1981 Returns 0.f if v < edge, 1.f otherwise.
1982
1983 This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
1984version: 9
1985end:
1986
1987start:
1988w: 2, 3, 4
1989t: f32
1990name: step
1991ret: #2#1
1992arg: #2#1 edge
1993arg: #2 v
1994comment:
1995 Returns 0.f if v < edge, 1.f otherwise.
1996
1997 This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
1998version: 9
1999end:
2000
2001start:
2002w: 2, 3, 4
2003t: f32
2004name: step
2005ret: #2#1
2006arg: #2 edge
2007arg: #2#1 v
2008comment:
2009 Returns 0.f if v < edge, 1.f otherwise.
2010
2011 This can be useful to create conditional computations without using loops and branching instructions. For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
2012version: 21
2013end:
2014
2015start:
2016w: 1, 2, 3, 4
2017t: f32
2018name: tan
2019ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002020arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002021comment:
2022 Returns the tangent of an angle measured in radians.
2023version: 9
2024end:
2025
2026start:
2027w: 1, 2, 3, 4
2028t: f32
2029name: tanh
2030ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002031arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002032comment:
2033 Returns the hyperbolic tangent of a value.
2034version: 9
2035end:
2036
2037start:
2038w: 1, 2, 3, 4
2039t: f32
2040name: tanpi
2041ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002042arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002043comment:
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002044 Returns the tangent of (v * pi), where (v * pi) is measured in radians.
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002045
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002046 To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002047version: 9
2048end:
2049
2050start:
2051w: 1, 2, 3, 4
2052t: f32
2053name: tgamma
2054ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002055arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002056comment:
2057 Returns the gamma function of a value.
2058version: 9
2059end:
2060
2061start:
2062w: 1, 2, 3, 4
2063t: f32
2064name: trunc
2065ret: #2#1
Jean-Luc Brouilletd52feb02014-12-19 17:32:18 -08002066arg: #2#1 v
Jean-Luc Brouillet7eddce42014-12-18 15:55:32 -08002067comment:
2068 Rounds to integral using truncation.
2069
2070 For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
2071
2072 See rint() and round() for other rounding options.
2073version: 9
2074end: