Oracle 5.0 Reference Manual page 934

Table of Contents

Advertisement

As of MySQL 5.0.3,
argument:
• For exact-value numbers,
nearest" rule: A value with a fractional part of .5 or greater is rounded up to the next integer if
positive or down to the next integer if negative. (In other words, it is rounded away from zero.) A
value with a fractional part less than .5 is rounded down to the next integer if positive or up to the
next integer if negative.
• For approximate-value numbers, the result depends on the C library. On many systems, this
means that
ROUND()
is rounded to the nearest even integer.
The following example shows how rounding differs for exact and approximate values:
mysql>
SELECT ROUND(2.5), ROUND(25E-1);
+------------+--------------+
| ROUND(2.5) | ROUND(25E-1) |
+------------+--------------+
| 3
|
+------------+--------------+
For more information, see
[914]
SIGN(X)
Returns the sign of the argument as -1, 0, or 1, depending on whether
positive.
mysql>
SELECT SIGN(-32);
-> -1
mysql>
SELECT SIGN(0);
-> 0
mysql>
SELECT SIGN(234);
-> 1
[914]
SIN(X)
Returns the sine of X, where
mysql>
SELECT SIN(PI());
-> 1.2246063538224e-16
mysql>
SELECT ROUND(SIN(PI()));
-> 0
[914]
SQRT(X)
Returns the square root of a nonnegative number X.
mysql>
SELECT SQRT(4);
-> 2
mysql>
SELECT SQRT(20);
-> 4.4721359549996
mysql>
SELECT SQRT(-16);
-> NULL
[914]
TAN(X)
Returns the tangent of X, where
mysql>
SELECT TAN(PI());
-> -1.2246063538224e-16
mysql>
SELECT TAN(PI()+1);
-> 1.5574077246549
[914]
TRUNCATE(X,D)
Mathematical Functions
[913]
uses the following rules depending on the type of the first
ROUND()
[913]
ROUND()
[913]
uses the "round to nearest even" rule: A value with any fractional part
2 |
Section 12.17, "Precision
is given in radians.
X
is given in radians.
X
914
uses the "round half away from zero" or "round toward
Math".
is negative, zero, or
X

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents