Re: ROUND inconsistency
| From: | Philip Hallstrom | Date: | Fri, 13 Apr 2001 21:03:30 +0000 |
| Subject: | Re: ROUND inconsistency | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-48486@lists.php.net to get a copy of this message | ||
In article <9b6c4v$m41$1@toye.p.sourceforge.net> you write:
>Correction, MySQL is not returning floor, since it returns 2 for round(1.5). - I
>didn't see it.
>MySQL should not return 2 for round(2.5), but it should return 3. I think it's
>MySQL bug.
>
>How about ask in MySQL mailing list?
I don't think it's just a MySQL thing... it occurs in PostgreSQL as
well...
test=> select version();
version
------------------------------------------------------------------------
PostgreSQL 7.0.3 on i386-unknown-freebsdelf4.1, compiled by gcc 2.95.2
(1 row)
test=> select round(1.5);
round
-------
2
(1 row)
test=> select round(2.5);
round
-------
2
(1 row)
However, you could always do floor(number + .5) to consistent
behaviour...
-philip