#### Integer functions

Function: ncptl_int ncptl_func_sqrt (ncptl_int num)
Function: double ncptl_dfunc_sqrt (double num)

ncptl_func_sqrt() returns the unique integer x such that x*x <= num and (x+1)*(x+1) > num. ncptl_dfunc_sqrt() returns the square root of num in double-precision arithmetic.

Function: ncptl_int ncptl_func_cbrt (ncptl_int num)
Function: double ncptl_dfunc_cbrt (double num)

ncptl_func_cbrt() returns the unique integer x such that x*x*x <= num and (x+1)*(x+1)*(x+1) > num. ncptl_dfunc_cbrt() returns the cube root of num in double-precision arithmetic.

Function: ncptl_int ncptl_func_root (ncptl_int root, ncptl_int num)
Function: double ncptl_dfunc_root (double root, double num)

Return the rootth root of a number num. ncptl_func_root() returns the largest-in-magnitude integer x with the same sign as num such that |x^root| <= |num|. Currently, num must be nonnegative but this may change in a future release of coNCePTuaL.

Function: ncptl_int ncptl_func_bits (ncptl_int num)
Function: double ncptl_dfunc_bits (double num)

Return the minimum number of bits needed to represent a given integer. (num is rounded up to the nearest integer in the case of ncptl_dfunc_bits().)

Function: ncptl_int ncptl_func_shift_left (ncptl_int num, ncptl_int bits)
Function: double ncptl_dfunc_shift_left (double num, double bits)

Shift a number to the left by bits bits. This corresponds to multiplying num by 2^bits. In the case of ncptl_dfunc_shift_left(), num and bits are first converted to ncptl_int values. There are no corresponding ncptl_func_shift_right() or ncptl_dfunc_shift_right() functions because shifting right by x is defined to be equivalent to shifting left by -x.

Function: ncptl_int ncptl_func_log10 (ncptl_int num)
Function: double ncptl_dfunc_log10 (double num)

Return the base-10 logarithm of num. In the case of ncptl_func_log10(), this value is rounded down to the nearest integer.

Function: ncptl_int ncptl_func_factor10 (ncptl_int num)
Function: double ncptl_dfunc_factor10 (double num)

Return num rounded down to the nearest single-digit factor of a power of 10.

Function: ncptl_int ncptl_func_abs (ncptl_int num)
Function: double ncptl_dfunc_abs (double num)

Return num’s absolute value. In the case of ncptl_func_log10(), this value is rounded down to the nearest integer.

Function: ncptl_int ncptl_func_power (ncptl_int base, ncptl_int exponent)
Function: double ncptl_dfunc_power (double base, double exponent)

Return base raised to the power of exponent.

Function: ncptl_int ncptl_func_modulo (ncptl_int numerator, ncptl_int denominator)
Function: double ncptl_dfunc_modulo (double numerator, double denominator)

Return the remainder of dividing numerator by denominator. The result is guaranteed to be a nonnegative integer. ncptl_dfunc_modulo() rounds each of numerator and denominator down to the nearest integer before dividing and taking the remainder.

Function: ncptl_int ncptl_func_min (ncptl_int count, …)
Function: double ncptl_dfunc_min (double count, …)

Return the minimum of a list of numbers. The first argument specifies the number of remaining arguments and must be a positive integer.

Function: ncptl_int ncptl_func_max (ncptl_int count, …)
Function: double ncptl_dfunc_max (double count, …)

Return the maximum of a list of numbers. The first argument specifies the number of remaining arguments and must be a positive integer.

Scott Pakin, pakin@lanl.gov