Publication date: 07/08/2024

Numeric SQL Functions

Numeric Function

Native SQLite

Description

ABS( number )

Returns the absolute value of the specified number.

ACOS( cosine )

Returns the angle in radians for the specified cosine.

ASIN( sin )

Returns the angle in radians for the specified sine.

ATAN( tangent )

Returns the angle in radians for the specified tangent.

ATAN2( x, y )

Two-argument arctangent function.

CEILING( number )

CEIL( number )

Returns the smallest integer larger than the specified number.

COS( radians )

Returns the cosine of the specified angle in radians.

COT( radians )

Returns the cotangent of the specified angle in radians.

DEGREES( radians )

Converts an angle in radians to an angle in degrees.

EXP( number )

Returns the constant e raised to the specified power.

FLOOR( number )

Returns the largest integer smaller than the specified number.

LN( number )

LOG( number )

Returns the natural logarithm of the specified number.

LOG10( number )

Returns the common logarithm of the specified number.

MAX( n1, n2, ... )

Yes

Returns the largest of the specified numbers. A minimum of two numbers must be specified.

MIN( n1, n2, ... )

Yes

Returns the smallest of the specified numbers. A minimum of two numbers must be specified.

MOD( dividend, divisor )

Returns the remainder when dividend is divided by divisor. Floating-point values are truncated to integers before the modulus operation is performed.

PI()

Returns the value of the constant pi (π).

POWER( number, power )

POW( number, power )

Raises number to the specified power.

RADIANS( degrees )

Converts an angle in degrees to an angle in radians.

RANDOM()

RANDOM( max )

RANDOM( min, max )

Returns a random number. RANDOM() returns a number between 0 and 1. RANDOM( max ) returns a number between 0 and max. RANDOM( min, max ) returns a number between min and max. This function is equivalent to the Random Uniform() JSL function, and its seed can be controlled using the Random Reset() JSL function. RANDOM can be shortened to RAND.

RANDOMBLOB( length )

Yes

Returns an N-byte blob that contains pseudo-random bytes. See the SQLite Online documentation at https://www.sqlite.org/lang.html.

ROUND( number, <precision> )

Rounds number to the number of decimal places given by precision. The default value of precision is 0, and precision can be negative.

SIGN( number )

Returns 1 if number is positive, -1 if number is negative, or 0 if number is zero.

SIN( radians )

Returns the sin of the specified angle in radians.

SQRT( number )

Returns the square root of number.

TAN( radians )

Returns the tangent of the specified angle in radians.

TRUNCATE( number, <precision> )

Truncates number at the number of decimal places given by precision. The default value of precision is 0, and precision can be negative. TRUNCATE() can be shortened to TRUNC().

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).