1.6. 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 ( long long int a, long long int b )
Calculate the maximum value of the input longlongint arguments.
__device__ ​ long long int llmin ( long long int a, long long int b )
Calculate the minimum value of the input longlongint arguments.
__device__ ​ unsigned long long int max ( unsigned long long int a, long long int b )
Calculate the maximum value of the input unsignedlonglongint and longlongint arguments.
__device__ ​ unsigned long long int max ( long long int a, unsigned long long int b )
Calculate the maximum value of the input longlongint and unsignedlonglongint arguments.
__device__ ​ unsigned long long int max ( unsigned long long int a, unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
__device__ ​ long long int max ( long long int a, long long int b )
Calculate the maximum value of the input longlongint arguments.
__device__ ​ unsigned long int max ( unsigned long int a, long int  b )
Calculate the maximum value of the input unsignedlongint and longint arguments.
__device__ ​ unsigned long int max ( long int  a, unsigned long int b )
Calculate the maximum value of the input longint and unsignedlongint arguments.
__device__ ​ unsigned long int max ( unsigned long int a, unsigned long int b )
Calculate the maximum value of the input unsignedlongint arguments.
__device__ ​ long int max ( long int  a, long int  b )
Calculate the maximum value of the input longint arguments.
__device__ ​ unsigned int max ( unsigned int  a, int  b )
Calculate the maximum value of the input unsignedint and int arguments.
__device__ ​ unsigned int max ( int  a, unsigned int  b )
Calculate the maximum value of the input int and unsignedint arguments.
__device__ ​ unsigned int max ( unsigned int  a, unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
__device__ ​ int max ( int  a, int  b )
Calculate the maximum value of the input int arguments.
__device__ ​ unsigned long long int min ( unsigned long long int a, long long int b )
Calculate the minimum value of the input unsignedlonglongint and longlongint arguments.
__device__ ​ unsigned long long int min ( long long int a, unsigned long long int b )
Calculate the minimum value of the input longlongint and unsignedlonglongint arguments.
__device__ ​ unsigned long long int min ( unsigned long long int a, unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
__device__ ​ long long int min ( long long int a, long long int b )
Calculate the minimum value of the input longlongint arguments.
__device__ ​ unsigned long int min ( unsigned long int a, long int  b )
Calculate the minimum value of the input unsignedlongint and longint arguments.
__device__ ​ unsigned long int min ( long int  a, unsigned long int b )
Calculate the minimum value of the input longint and unsignedlongint arguments.
__device__ ​ unsigned long int min ( unsigned long int a, unsigned long int b )
Calculate the minimum value of the input unsignedlongint arguments.
__device__ ​ long int min ( long int  a, long int  b )
Calculate the minimum value of the input longint arguments.
__device__ ​ unsigned int min ( unsigned int  a, int  b )
Calculate the minimum value of the input unsignedint and int arguments.
__device__ ​ unsigned int min ( int  a, unsigned int  b )
Calculate the minimum value of the input int and unsignedint arguments.
__device__ ​ unsigned int min ( unsigned int  a, unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.
__device__ ​ int min ( int  a, int  b )
Calculate the minimum value of the input int arguments.
__device__ ​ unsigned long long int ullmax ( unsigned long long int a, unsigned long long int b )
Calculate the maximum value of the input unsignedlonglongint arguments.
__device__ ​ unsigned long long int ullmin ( unsigned long long int a, unsigned long long int b )
Calculate the minimum value of the input unsignedlonglongint arguments.
__device__ ​ unsigned int umax ( unsigned int  a, unsigned int  b )
Calculate the maximum value of the input unsignedint arguments.
__device__ ​ unsigned int umin ( unsigned int  a, 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 ( long long int a, 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 ( long long int a, 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 ( unsigned long long int a, 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 ( long long int a, 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 ( unsigned long long int a, 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 ( long long int a, 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 ( unsigned long int a, 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 ( long int  a, 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 ( unsigned long int a, 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 ( long int  a, 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 ( unsigned int  a, 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 ( int  a, 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 ( unsigned int  a, 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 ( int  a, 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 ( unsigned long long int a, 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 ( long long int a, 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 ( unsigned long long int a, 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 ( long long int a, 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 ( unsigned long int a, 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 ( long int  a, 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 ( unsigned long int a, 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 ( long int  a, 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 ( unsigned int  a, 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 ( int  a, 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 ( unsigned int  a, 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 ( int  a, 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 ( unsigned long long int a, 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 ( unsigned long long int a, 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 ( unsigned int  a, 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 ( unsigned int  a, unsigned int  b )
Calculate the minimum value of the input unsignedint arguments.
Description

Calculate the minimum value of the arguments a and b.