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