![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 4 340 Pomógł: 542 Dołączył: 15.01.2006 Skąd: Olsztyn/Warszawa Ostrzeżenie: (0%) ![]() ![]() |
Witam mam coś takiego
i wynik dostaje taki. Kod sum( srba.przychod ) => 218316.50 round( sum( srba.przychod ) ) => 218316 z czego może wynikać fakt zaokrąglenia w dół (IMG:style_emoticons/default/questionmark.gif) Pozdrawiam. Ten post edytował skowron-line 9.12.2009, 10:06:33 |
|
|
![]()
Post
#2
|
|
Grupa: Moderatorzy Postów: 36 557 Pomógł: 6315 Dołączył: 27.12.2004 ![]() |
http://dev.mysql.com/doc/refman/5.0/en/mat...#function_round
moze chodzi o to: Cytat For exact-value numbers, ROUND() uses the “round half up” 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 negative.
For approximate-value numbers, the result depends on the C library. On many systems, this means that ROUND() 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) | +------------+--------------+ | 3 | 2 | |
|
|
![]() ![]() |
![]() |
Aktualny czas: 22.08.2025 - 23:50 |