Mathematical Functions
908
Name
Description
TRUNCATE()
[914]
Truncate to specified number of decimal places
All mathematical functions return
NULL
in the event of an error.
•
ABS(X)
[908]
Returns the absolute value of
X
.
mysql>
SELECT ABS(2);
-> 2
mysql>
SELECT ABS(-32);
-> 32
This function is safe to use with
BIGINT
values.
•
ACOS(X)
[908]
Returns the arc cosine of
X
, that is, the value whose cosine is
X
. Returns
NULL
if
X
is not in the range
-1
to
1
.
mysql>
SELECT ACOS(1);
-> 0
mysql>
SELECT ACOS(1.0001);
-> NULL
mysql>
SELECT ACOS(0);
-> 1.5707963267949
•
ASIN(X)
[908]
Returns the arc sine of
X
, that is, the value whose sine is
X
. Returns
NULL
if
X
is not in the range
-1
to
1
.
mysql>
SELECT ASIN(0.2);
-> 0.20135792079033
mysql>
SELECT ASIN('foo');
+-------------+
| ASIN('foo') |
+-------------+
| 0 |
+-------------+
1 row in set, 1 warning (0.00 sec)
mysql>
SHOW WARNINGS;
+---------+------+-----------------------------------------+
| Level | Code | Message |
+---------+------+-----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'foo' |
+---------+------+-----------------------------------------+
•
ATAN(X)
[908]
Returns the arc tangent of
X
, that is, the value whose tangent is
X
.
mysql>
SELECT ATAN(2);
-> 1.1071487177941
mysql>
SELECT ATAN(-2);
-> -1.1071487177941
•
ATAN(Y,X)
[908]
,
ATAN2(Y,X)
[908]
Returns the arc tangent of the two variables
X
and
Y
. It is similar to calculating the arc tangent of
Y /
X
, except that the signs of both arguments are used to determine the quadrant of the result.
mysql>
SELECT ATAN(-2,2);
-> -0.78539816339745
mysql>
SELECT ATAN2(PI(),0);
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...