Intrinsic math functions
        
                        
                                    
                        RenderScript provides a lot of intrinsic math functions, which are optimized using NEON instructions (on ARMv7 devices). These functions should be used instead of writing pure calculations when possible. 
For example,  a * b + c
  should be translated into  fma(a, b, c)
 .
 Note:  functions' arguments are assumed to be of type that matches function's return one. Otherwise, different type is specified.  | 
                     
                             
                            
                             
    
    
            Float functions (part 1)
        
                        
                                                                                    
                                                                                            Definition  | 
                                                                                                                        Description  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse hyperbolic cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse cosine divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse hyperbolic sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse sine divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse tangent of a ratio  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse tangent of a ratio, divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse hyperbolic tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Inverse tangent divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Cube root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Smallest integer not less than a value  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Restrain a value to a range  | 
                                                                                 
                                                                                            
                                                                                            copysign(magnitude, sign)
  | 
                                                                                                                        Copies the sign of a number to another.  copysign(4.0f, -2.7f)
  returns  -4.0f
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Hypebolic cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Cosine of a number multiplied by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Converts radians into degrees  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Mathematical error function  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Mathematical complementary error function  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        e raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        10 raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        2 raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        e raised to a number minus one:  (e ^ v) - 1
   | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Absolute value of a float  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Positive difference between two values. If  a > b
 , returns  (a - b)
  otherwise returns  0f
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Smallest integer not greater than a value/  (multiplicand1 * multiplicand2) + offset
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Multiply and add  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Maximum of two floats  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Minimum of two floats  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Modulo  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Positive fractional part.  fract(2.3f, &val)
  returns  0.3f
  and sets val to  2.f
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Binary mantissa and exponent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Reciprocal computed to 16 bit precision  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Reciprocal of a square root computed to 16 bit precision  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Square root computed to 16 bit precision  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
    
            Float functions (part 2)
        
                        
                                                                                    
                                                                                            Definition  | 
                                                                                                                        Description  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Hypotenuse  | 
                                                                                 
                                                                                            
                                                                                            ldexp(mantissa, int exponent)
  | 
                                                                                                                        Creates a floating point from mantissa and exponent.  mantissa * 2 ^ exponent
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Natural logarithm of the gamma function  | 
                                                                                 
                                                                                            
                                                                                            lgamma(v, int* sign_of_gamma)
  | 
                                                                                                                        Natural logarithm of the gamma function. 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
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Natural logarithm  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base 10 logarithm  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Natural logarithm of a value plus 1  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base 2 logarithm  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base two exponent.  logb(8.5f)
  returns  3.f
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Multiply and add  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Maximum  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Minimum  | 
                                                                                 
                                                                                            
                                                                                            modf(v, float* integral_part)
  | 
                                                                                                                        Integral and fractional components.  modf(-3.72f)
  will return  0.72f
  and  integral_part
  will be set to  -3.f
  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Returns NaN  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Next representable floating point number from v towards target  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base raised to an exponent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base raised to an integer exponent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Positive base raised to an exponent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Converts degrees into radians  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Remainder of a division  | 
                                                                                 
                                                                                            
                                                                                            remquo(num, int* quotient)
  | 
                                                                                                                        Remainder and quotient of a division  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Round to even  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Nth root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Round away from zero  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Reciprocal of a square root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Sign of a value  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Sine and cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Hyperbolic sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Sine of a number multiplied by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Square root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Returns  0.f
  if  v < edge
 ,  1.f
  otherwise  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Hyperbolic tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Tangent of a number multiplied by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Gamma function  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Truncates a floating point  | 
                                                                                 
                                                                         
                             
                             | 
                                                                              | 
                                                        
                                
    
    
            Integer functions (return int)
        
                        
                                                                                    
                                                                                            Definition  | 
                                                                                                                        Description  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Absolute value of an integer  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Restrain a value to a range (min API 19)  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Number of leading 0 bits  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Base two exponent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Maximum value of two arguments  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Minimum value of two arguments  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Pseudo-random number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Pseudo-random number  | 
                                                                                 
                                                                         
                             
    
    
            Approximate float functions (API >= 21)
        
                        
                                                                                    
                                                                                            Following functions have stricter limits than precise ones. Please refer to  specs to see them.  | 
                                                                                 
                                                                                            
                                                                                            Definition  | 
                                                                                                                        Description  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate base 2 logarithm (API 18)  | 
                                                                                 
                                                                                            
                                                                                            native_powr(base, exp)
  | 
                                                                                                                        Approximate positive base raised to an exponent (API 18)  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse hyperbolic cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse cosine divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse hyperbolic sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse sine divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse tangent  | 
                                                                                 
                                                                                            
                                                                                            native_atan2(num, den)
  | 
                                                                                                                        Approximate inverse tangent of a ratio  | 
                                                                                 
                                                                                            
                                                                                            native_atan2pi(num, den)
  | 
                                                                                                                        Approximate inverse tangent of a ratio, divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse hyperbolic tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate inverse tangent divided by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate cube root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate hypebolic cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate cosine of a number multiplied by pi  | 
                                                                                 
                                                                                            
                                                                                            native_divide(left, right)
  | 
                                                                                                                        Approximate division  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate e raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate 10 raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate 2 raised to a number  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate e raised to a number minus one  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate hypotenuse  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate natural logarithm  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate base 10 logarithm  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate natural logarithm of a value plus 1  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate reciprocal  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate nth root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate reciprocal of a square root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate sine  | 
                                                                                 
                                                                                            
                                                                                            native_sincos(v, float* cos);
  | 
                                                                                                                        Approximate sine and cosine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate hyperbolic sine  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate sine of a number multiplied by pi  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate square root  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate hyperbolic tangent  | 
                                                                                 
                                                                                            
                                                                                             | 
                                                                                                                        Approximate tangent of a number multiplied by pi  | 
                                                                                 
                                                                         
                             
                             |