1.7. Integer Mathematical Functions

This section describes integer mathematical functions. To use these functions you do not need to include any additional header files in your program.

Functions

__device__ ​ int abs ( int  a )
Calculate the absolute value of the input int argument.
__device__ ​ long int labs ( long int  a )
Calculate the absolute value of the input longint argument.
__device__ ​ long long int llabs ( long long int a )
Calculate the absolute value of the input longlongint argument.
__device__ ​ long long int llmax ( const long long int a, const long long int b )
Calculate the maximum value of the input longlongint arguments.
__device__ ​ long long int llmin ( const long long int a, const long long int b )
Calculate the minimum value of the input longlongint arguments.
__device__ ​ unsigned long long int max ( const unsigned long long int a, const long long int b )
Calculate the maximum value of the input unsignedlonglongint and longlongint arguments.
__device__ ​ unsigned long long int max ( const long long int a, const unsigned long long int b )
Calculate the maximum value of the input longlongint and unsignedlonglongint arguments.
__device__ ​ unsigned long long int max ( const unsigned long long int a, const unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
__device__ ​ long long int max ( const long long int a, const long long int b )
Calculate the maximum value of the input longlongint arguments.
__device__ ​ unsigned long int max ( const unsigned long int a, const long int  b )
Calculate the maximum value of the input unsignedlongint and longint arguments.
__device__ ​ unsigned long int max ( const long int  a, const unsigned long int b )
Calculate the maximum value of the input longint and unsignedlongint arguments.
__device__ ​ unsigned long int max ( const unsigned long int a, const unsigned long int b )
Calculate the maximum value of the input unsignedlongint arguments.
__device__ ​ long int max ( const long int  a, const long int  b )
Calculate the maximum value of the input longint arguments.
__device__ ​ unsigned int max ( const unsigned int  a, const int  b )
Calculate the maximum value of the input unsignedint and int arguments.
__device__ ​ unsigned int max ( const int  a, const unsigned int  b )
Calculate the maximum value of the input int and unsignedint arguments.
__device__ ​ unsigned int max ( const unsigned int  a, const unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
__device__ ​ int max ( const int  a, const int  b )
Calculate the maximum value of the input int arguments.
__device__ ​ unsigned long long int min ( const unsigned long long int a, const long long int b )
Calculate the minimum value of the input unsignedlonglongint and longlongint arguments.
__device__ ​ unsigned long long int min ( const long long int a, const unsigned long long int b )
Calculate the minimum value of the input longlongint and unsignedlonglongint arguments.
__device__ ​ unsigned long long int min ( const unsigned long long int a, const unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
__device__ ​ long long int min ( const long long int a, const long long int b )
Calculate the minimum value of the input longlongint arguments.
__device__ ​ unsigned long int min ( const unsigned long int a, const long int  b )
Calculate the minimum value of the input unsignedlongint and longint arguments.
__device__ ​ unsigned long int min ( const long int  a, const unsigned long int b )
Calculate the minimum value of the input longint and unsignedlongint arguments.
__device__ ​ unsigned long int min ( const unsigned long int a, const unsigned long int b )
Calculate the minimum value of the input unsignedlongint arguments.
__device__ ​ long int min ( const long int  a, const long int  b )
Calculate the minimum value of the input longint arguments.
__device__ ​ unsigned int min ( const unsigned int  a, const int  b )
Calculate the minimum value of the input unsignedint and int arguments.
__device__ ​ unsigned int min ( const int  a, const unsigned int  b )
Calculate the minimum value of the input int and unsignedint arguments.
__device__ ​ unsigned int min ( const unsigned int  a, const unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.
__device__ ​ int min ( const int  a, const int  b )
Calculate the minimum value of the input int arguments.
__device__ ​ unsigned long long int ullmax ( const unsigned long long int a, const unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
__device__ ​ unsigned long long int ullmin ( const unsigned long long int a, const unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
__device__ ​ unsigned int umax ( const unsigned int  a, const unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
__device__ ​ unsigned int umin ( const unsigned int  a, const unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.

Functions

__device__ ​ int abs ( int  a )
Calculate the absolute value of the input int argument.
Description

Calculate the absolute value of the input argument a.

__device__ ​ long int labs ( long int  a )
Calculate the absolute value of the input longint argument.
Description

Calculate the absolute value of the input argument a.

__device__ ​ long long int llabs ( long long int a )
Calculate the absolute value of the input longlongint argument.
Description

Calculate the absolute value of the input argument a.

__device__ ​ long long int llmax ( const long long int a, const long long int b )
Calculate the maximum value of the input longlongint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ long long int llmin ( const long long int a, const long long int b )
Calculate the minimum value of the input longlongint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ unsigned long long int max ( const unsigned long long int a, const long long int b )
Calculate the maximum value of the input unsignedlonglongint and longlongint arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long long int max ( const long long int a, const unsigned long long int b )
Calculate the maximum value of the input longlongint and unsignedlonglongint arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long long int max ( const unsigned long long int a, const unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ long long int max ( const long long int a, const long long int b )
Calculate the maximum value of the input longlongint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ unsigned long int max ( const unsigned long int a, const long int  b )
Calculate the maximum value of the input unsignedlongint and longint arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long int max ( const long int  a, const unsigned long int b )
Calculate the maximum value of the input longint and unsignedlongint arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long int max ( const unsigned long int a, const unsigned long int b )
Calculate the maximum value of the input unsignedlongint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ long int max ( const long int  a, const long int  b )
Calculate the maximum value of the input longint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ unsigned int max ( const unsigned int  a, const int  b )
Calculate the maximum value of the input unsignedint and int arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned int max ( const int  a, const unsigned int  b )
Calculate the maximum value of the input int and unsignedint arguments.
Description

Calculate the maximum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned int max ( const unsigned int  a, const unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ int max ( const int  a, const int  b )
Calculate the maximum value of the input int arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ unsigned long long int min ( const unsigned long long int a, const long long int b )
Calculate the minimum value of the input unsignedlonglongint and longlongint arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long long int min ( const long long int a, const unsigned long long int b )
Calculate the minimum value of the input longlongint and unsignedlonglongint arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long long int min ( const unsigned long long int a, const unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ long long int min ( const long long int a, const long long int b )
Calculate the minimum value of the input longlongint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ unsigned long int min ( const unsigned long int a, const long int  b )
Calculate the minimum value of the input unsignedlongint and longint arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long int min ( const long int  a, const unsigned long int b )
Calculate the minimum value of the input longint and unsignedlongint arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned long int min ( const unsigned long int a, const unsigned long int b )
Calculate the minimum value of the input unsignedlongint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ long int min ( const long int  a, const long int  b )
Calculate the minimum value of the input longint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ unsigned int min ( const unsigned int  a, const int  b )
Calculate the minimum value of the input unsignedint and int arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned int min ( const int  a, const unsigned int  b )
Calculate the minimum value of the input int and unsignedint arguments.
Description

Calculate the minimum value of the arguments a and b, perform integer promotion first.

__device__ ​ unsigned int min ( const unsigned int  a, const unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ int min ( const int  a, const int  b )
Calculate the minimum value of the input int arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ unsigned long long int ullmax ( const unsigned long long int a, const unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ unsigned long long int ullmin ( const unsigned long long int a, const unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
Description

Calculate the minimum value of the arguments a and b.

__device__ ​ unsigned int umax ( const unsigned int  a, const unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
Description

Calculate the maximum value of the arguments a and b.

__device__ ​ unsigned int umin ( const unsigned int  a, const unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.
Description

Calculate the minimum value of the arguments a and b.