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