roundingget down too5

289480 & (acid2) Tracking bug for acid2 (acid 2) test
Tracking bug for acid2 (acid 2) test
Tracking bug for acid2 (acid 2) test
[reflow-refactor]
Components
chris hofmann
QA Contact:
chris hofmann
Duplicates:
Show dependency
15:36 PDT by Doug Wright
alexander.grimalovsky
ancestor.ak
andrew.listochkin
andrewm715+bugzilla
bernzilla+bugs
BijuMailList
bogofilter+mozilla
bugmail-mozilla
bugspam.Callek
bugzilla.mozilla.org-3
bugzilla.mozilla.org
bugzilla.mozilla.org
bugzilla.mozilla.org
bugzilla.mozilla.org
bugzilla.mozilla
cbiesinger
crackshot1980
davemgarrett
davidaznarregue
deleeuw+bugzilla
deprecationmail
djcater+bugzilla
Filip.Jirsak
fullmetaljacket.xp+bugmail
gavin.sharp
hubert+bmo
jeanmichel.reghem
Jim_Ronback
jo.hermans
jormundgand
jose.fandos
jwalden+bmo
khanreaper
lapsap7+mz
maikelkrause
malcolm-bmo
markushuebner
martin-bugs
matthias79
mediaright
michal.grezl
misak.bugzilla
mozilla-06
mozilla.bugs
netrolller.3d
nikolaymetchev
patrick.hendriks+bugzilla
pavel.penaz
raf+bugzilla1
sciguyryan
sendmail.to
shayne.anthony.jewers
simon.sapin
spitfire.kuden
steffen.wilberg
steve.england
supernova00
thetechnut
tobias.weibel
torres.dark
tpowellmoz
tuukka.tolvanen
whitewolfpro
will.j.may
worcester12345
blocking1.9-
wanted1.9+
Project Flags:
Tracking Flags:
Attachments
|   |MySQL 5.6 Reference Manual :: 12.6.2 Mathematical Functions
MySQL 5.6 Manual
Section Navigation &&&&&[]
12.6.2 Mathematical Functions
Table 12.12 Mathematical Functions
NameDescriptionReturn the absolute valueReturn the arc cosineReturn the arc sineReturn the arc tangent of the two argumentsReturn the arc tangentReturn the smallest integer value not less than the argumentReturn the smallest integer value not less than the argumentConvert numbers between different number basesReturn the cosineReturn the cotangentCompute a cyclic redundancy check valueConvert radians to degreesRaise to the power ofReturn the largest integer value not greater than the argumentReturn the natural logarithm of the argumentReturn the base-10 logarithm of the argumentReturn the base-2 logarithm of the argumentReturn the natural logarithm of the first argumentReturn the remainderReturn the value of piReturn the argument raised to the specified powerReturn the argument raised to the specified powerReturn argument converted to radiansReturn a random floating-point valueRound the argumentReturn the sign of the argumentReturn the sine of the argumentReturn the square root of the argumentReturn the tangent of the argumentTruncate to specified number of decimal places
All mathematical functions return NULL in the
event of an error.
Returns the absolute value of X.
mysql& SELECT ABS(2);
mysql& SELECT ABS(-32);
This function is safe to use with
Returns the arc cosine of X, that
is, the value whose cosine is X.
Returns NULL if
X is not in the range
mysql& SELECT ACOS(1);
mysql& SELECT ACOS(1.0001);
mysql& SELECT ACOS(0);
Returns the arc sine of X, that
is, the value whose sine is X.
Returns NULL if
X is not in the range
mysql& SELECT ASIN(0.2);
mysql& SELECT ASIN('foo');
+-------------+
| ASIN('foo') |
+-------------+
+-------------+
1 row in set, 1 warning (0.00 sec)
mysql& SHOW WARNINGS;
+---------+------+-----------------------------------------+
| Code | Message
+---------+------+-----------------------------------------+
| Warning | 1292 | Truncated incorrect DOUBLE value: 'foo' |
+---------+------+-----------------------------------------+
Returns the arc tangent of X,
that is, the value whose tangent is
mysql& SELECT ATAN(2);
mysql& SELECT ATAN(-2);
Returns the arc tangent of the two variables
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);
mysql& SELECT ATAN2(PI(),0);
is a synonym for
Returns the smallest integer value not less than
mysql& SELECT CEILING(1.23);
mysql& SELECT CEILING(-1.23);
For exact-value numeric arguments, the return value has an
exact-value numeric type. For string or floating-point
arguments, the return value has a floating-point type.
Converts numbers between different number bases. Returns a
string representation of the number
N, converted from base
from_base to base
to_base. Returns
NULL if any argument is
NULL. The argument
N is interpreted as an integer,
but may be specified as an integer or a string. The minimum
base is 2 and the maximum base is
36. If to_base
is a negative number, N is
regarded as a signed number. Otherwise,
N is treated as unsigned.
works with 64-bit
precision.
mysql& SELECT CONV('a',16,2);
mysql& SELECT CONV('6E',18,8);
mysql& SELECT CONV(-17,10,-18);
mysql& SELECT CONV(10+'10'+'10'+0xa,10,10);
Returns the cosine of X, where
X is given in radians.
mysql& SELECT COS(PI());
Returns the cotangent of X.
mysql& SELECT COT(12);
mysql& SELECT COT(0);
Computes a cyclic redundancy check value and returns a
32-bit unsigned value. The result is NULL
if the argument is NULL. The argument is
expected to be a string and (if possible) is treated as one
if it is not.
mysql& SELECT CRC32('MySQL');
mysql& SELECT CRC32('mysql');
Returns the argument X, converted
from radians to degrees.
mysql& SELECT DEGREES(PI());
mysql& SELECT DEGREES(PI() / 2);
Returns the value of e (the base of
natural logarithms) raised to the power of
X. The inverse of this function
(using a single
argument only) or .
mysql& SELECT EXP(2);
mysql& SELECT EXP(-2);
mysql& SELECT EXP(0);
Returns the largest integer value not greater than
mysql& SELECT FLOOR(1.23);
mysql& SELECT FLOOR(-1.23);
For exact-value numeric arguments, the return value has an
exact-value numeric type. For string or floating-point
arguments, the return value has a floating-point type.
Formats the number X to a format
like '#,###,###.##', rounded to
D decimal places, and returns the
result as a string. For details, see
This function can be used to obtain a hexadecimal
representation of a decima the manner
in which it does so varies according to the argument's
type. See this function's description in
, for details.
Returns the natural logarithm of
X; that is, the
base-e logarithm of
X is less than or equal to 0,
then NULL is returned.
mysql& SELECT LN(2);
mysql& SELECT LN(-2);
This function is synonymous with
The inverse of this function is the
If called with one parameter, this function returns the
natural logarithm of X. If
X is less than or equal to 0,
then NULL is returned.
The inverse of this function (when called with a single
argument) is the
mysql& SELECT LOG(2);
mysql& SELECT LOG(-2);
If called with two parameters, this function returns the
logarithm of X to the base
X is less than or equal to 0, or
if B is less than or equal to 1,
then NULL is returned.
mysql& SELECT LOG(2,65536);
mysql& SELECT LOG(10,100);
mysql& SELECT LOG(1,100);
is equivalent to
Returns the base-2 logarithm of
mysql& SELECT LOG2(65536);
mysql& SELECT LOG2(-100);
is useful for finding
out how many bits a number requires for storage. This
function is equivalent to the expression
Returns the base-10 logarithm of
mysql& SELECT LOG10(2);
mysql& SELECT LOG10(100);
mysql& SELECT LOG10(-100);
is equivalent to
Modulo operation. Returns the remainder of
N divided by
mysql& SELECT MOD(234, 10);
mysql& SELECT 253 % 7;
mysql& SELECT MOD(29,9);
mysql& SELECT 29 MOD 9;
This function is safe to use with
also works on values
that have a fractional part and returns the exact remainder
after division:
mysql& SELECT MOD(34.5,3);
returns NULL.
Returns the value of π (pi). The default number of
decimal places displayed is seven, but MySQL uses the full
double-precision value internally.
mysql& SELECT PI();
-& 3.141593
mysql& SELECT PI()+0.000000;
-& 3.793116
Returns the value of X raised to
the power of Y.
mysql& SELECT POW(2,2);
mysql& SELECT POW(2,-2);
This is a synonym for .
Returns the argument X, converted
from degrees to radians.
π radians equals 180 degrees.
mysql& SELECT RADIANS(90);
Returns a random floating-point value
v in the range
1.0. If a constant integer argument
N is specified, it is used as the
seed value, which produces a repeatable sequence of column
values. In the following example, the sequences of values
produced by RAND(3) are the same in both
places where they occur.
mysql& CREATE TABLE t (i INT);
Query OK, 0 rows affected (0.42 sec)
mysql& INSERT INTO t VALUES(1),(2),(3);
Query OK, 3 rows affected (0.00 sec)
Records: 3
Duplicates: 0
Warnings: 0
mysql& SELECT i, RAND() FROM
+------+------------------+
+------+------------------+
1 | 0.28 |
2 | 0.42 |
3 | 0.91 |
+------+------------------+
3 rows in set (0.00 sec)
mysql& SELECT i, RAND(3) FROM
+------+------------------+
+------+------------------+
1 | 0.06 |
2 | 0.35 |
3 | 0.19 |
+------+------------------+
3 rows in set (0.00 sec)
mysql& SELECT i, RAND() FROM
+------+------------------+
+------+------------------+
1 | 0.93 |
2 | 0.58 |
3 | 0.76 |
+------+------------------+
3 rows in set (0.00 sec)
mysql& SELECT i, RAND(3) FROM
+------+------------------+
+------+------------------+
1 | 0.06 |
2 | 0.35 |
3 | 0.19 |
+------+------------------+
3 rows in set (0.01 sec)
With a constant initializer, the seed is initialized once
when the statement is compiled, prior to execution. If a
nonconstant initializer (such as a column name) is used as
the argument, the seed is initialized with the value for
each invocation of .
(One implication of this is that for equal argument values,
will return the same
value each time.)
To obtain a random integer R in
the range i &=
j, use the expression
For example, to obtain a random integer in the range the
range 7 &=
R & 12, you
could use the following statement:
SELECT FLOOR(7 + (RAND() * 5));
WHERE clause is re-evaluated every time
the WHERE is executed.
You cannot use a column with
values in an
ORDER BY clause, because ORDER
BY would evaluate the column multiple times.
However, you can retrieve rows in random order like this:
mysql& SELECT * FROM tbl_name ORDER BY RAND();
ORDER BY RAND() combined with
LIMIT is useful for selecting a random
sample from a set of rows:
mysql& SELECT * FROM table1, table2 WHERE a=b AND c&d -& ORDER BY RAND() LIMIT 1000;
is not meant to be a
perfect random generator. It is a fast way to generate
random numbers on demand that is portable between platforms
for the same MySQL version.
This function is unsafe for statement-based replication. A
warning is logged if you use this function when
STATEMENT. (Bug #49222)
Rounds the argument X to
D decimal places. The rounding
algorithm depends on the data type of
defaults to 0 if not specified. D
can be negative to cause D digits
left of the decimal point of the value
X to become zero.
mysql& SELECT ROUND(-1.23);
mysql& SELECT ROUND(-1.58);
mysql& SELECT ROUND(1.58);
mysql& SELECT ROUND(1.298, 1);
mysql& SELECT ROUND(1.298, 0);
mysql& SELECT ROUND(23.298, -1);
The return type is the same type as that of the first
argument (assuming that it is integer, double, or decimal).
This means that for an integer argument, the result is an
integer (no decimal places):
mysql& SELECT ROUND(150.000,2), ROUND(150,2);
+------------------+--------------+
| ROUND(150.000,2) | ROUND(150,2) |
+------------------+--------------+
+------------------+--------------+
uses the following
rules depending on the type of the first argument:
For exact-value numbers,
“round half away from zero” or “round
toward 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
For approximate-value numbers, the result depends on the
C library. On many systems, this means that
uses the "round
to nearest even" rule: A value with any fractional part
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) |
+------------+--------------+
+------------+--------------+
For more information, see .
Returns the sign of the argument as -1,
0, or 1, depending on
whether X is negative, zero, or
mysql& SELECT SIGN(-32);
mysql& SELECT SIGN(0);
mysql& SELECT SIGN(234);
Returns the sine of X, where
X is given in radians.
mysql& SELECT SIN(PI());
-& 1.4e-16
mysql& SELECT ROUND(SIN(PI()));
Returns the square root of a nonnegative number
mysql& SELECT SQRT(4);
mysql& SELECT SQRT(20);
mysql& SELECT SQRT(-16);
Returns the tangent of X, where
X is given in radians.
mysql& SELECT TAN(PI());
-& -1.4e-16
mysql& SELECT TAN(PI()+1);
Returns the number X, truncated
to D decimal places. If
D is 0, the
result has no decimal point or fractional part.
D can be negative to cause
D digits left of the decimal
point of the value X to become
mysql& SELECT TRUNCATE(1.223,1);
mysql& SELECT TRUNCATE(1.999,1);
mysql& SELECT TRUNCATE(1.999,0);
mysql& SELECT TRUNCATE(-1.999,1);
mysql& SELECT TRUNCATE(122,-2);
mysql& SELECT TRUNCATE(10.28*100,0);
All numbers are rounded toward zero.ISSUU - South East Asia Backpacker Issue 22 by southeastasia backpacker
South East Asia Backpacker Issue 22
South East Asia Backpacker Issue 22
Travel stories, tips and inspiration about life backpacking in South East AsiaReported by:
Milestone:
Component:
Release Notes:
Refresh the default theme to take advantage of a few CSS3 features.
API Changes:
Attachments (16)
(126.4 KB) - added by lkraav &leho@…& .
Trac13 theme initial mockup
(22.6 KB) - added by cboos .
(22.7 KB) - added by cboos .
(55.9 KB) - added by cboos .
The proposed #mainnav, with straight borders, on a single line
(36.9 KB) - added by cboos .
The proposed #mainnav, with straight borders, on multiple lines
(17.1 KB) - added by cboos .
The #mainnav in stock Trac 0.12
(9.1 KB) - added by cboos .
closed by a border
(8.4 KB) - added by cboos .
current state
(10.6 KB) - added by psuter .
closed by a Unicode checkmark character
(182.1 KB) - added by lkraav &leho@…& .
(18.0 KB) - added by Ryan J Ollos &ryano@…& .
(30.7 KB) - added by cboos .
more compact comment actions
(87.3 KB) - added by cboos .
nicer wiki editing…
(12.3 KB) - added by cboos .
report list with
showing buttons with symbol + text
(12.1 KB) - added by cboos .
report list with
showing buttons with symbol only
(3.4 KB) - added by anonymous .
Download all attachments as:
Show property changes
Change History (127)
by lkraav &leho@…&
Attachment
osimons added
set to cboos
changed from new to assigned
Attachment
Attachment
Last edited
Attachment
Attachment
Attachment
ryano@… added
Attachment
Attachment
Attachment
(BTW, I knew I should have c-) )
Last edited
I would probably do the same for the properties box down below.
Since #content wants to have its 1em by default, which I think makes sense, we can do -1em on boxes we want to expand to container size.
Not sure why I didn't post a screenshot before. Attaching now.
by lkraav &leho@…&
Attachment
by Ryan J Ollos &ryano@…&
Attachment
Last edited
Attachment
Attachment
Last edited
Attachment
Attachment
by anonymous
Attachment
& but I'm not sure it's a good idea. This outline is useful for accessibility. Only FF seems to have trouble sizing it exactly on the &li&, Chrome and IE do it right (Safari and Opera don't bother moving the focus there).
Last edited
Version 0, edited
Resolution
set to fixed
changed from assigned to closed
Release Notes
modified ()
changed from normal to major
Last edited
by rjollos
ryano@… removed
for help on using
Download in other formats:}

我要回帖

更多关于 rounding necessary 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信