Numeric Value Functions

Describes some commonly used numeric functions like, ABS(), CEILING(), COS(), PI(), RANDOM(), ROUND(), and TRUNCATE().

MySQL supports a number of built-in functions that allows you to manipulate numeric values.

"ABS(number)" - Returns the absolute value of the specified number.

"CEILING(number)" - Returns the smallest integer value not less than the specified number.

"COS(number)" - Returns the cosine of the specified number.

"PI()" - Returns the value of PI, 3.141592653589793116.

"EXP(number)" - Returns the value of e raise to the power of the specified number.

"FLOOR(number)" - Returns the largest integer value not greater than the specified number.

"GREATEST(list)" - Returns the largest value of the specified list of values.

"LEAST(list)" - Returns the smallest value of the specified list of values.

"RAND()" - Returns a random number between 0 and 1.

"ROUND(number)" - Returns the nearest integer of the specified number.

"ROUND(number, position)" - Returns the rounded value of the specified number at the specified decimal position.

"SIGN(number)" - Returns -1, 0 or 1 if the specified number is negative, zero or positive.

"TRUNCATE(number, position)" - Returns the truncated value of the specified number at the specified decimal position.

Examples of numeric functions, NumericFunctions.sql:

```-- NumericFunctions.sql
--
SELECT PI();
SELECT CEILING(PI());
SELECT FLOOR(PI());
SELECT ROUND(PI(),4);
SELECT TRUNCATE(PI(),4);
```

Output:

```PI()
3.141593
CEILING(PI())
4
FLOOR(PI())
3
ROUND(PI(),4)
3.1416
TRUNCATE(PI(),4)
3.1415
```