Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f994ghn88049 for ; Tue, 9 Oct 2001 00:42:44 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f994gfI21190; Tue, 9 Oct 2001 00:42:41 -0400 (EDT) To: "Saurabh Mittal" cc: pgsql-sql@postgresql.org Subject: Re: ROUND function ?? In-reply-to: References: Comments: In-reply-to "Saurabh Mittal" message dated "Tue, 09 Oct 2001 09:15:42 +0530" Date: Tue, 09 Oct 2001 00:42:41 -0400 Message-ID: <21186.1002602561@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200110/129 X-Sequence-Number: 5084 "Saurabh Mittal" writes: > select ROUND(0.5) ; returns 0 > select ROUND(1.5) ; returns 2; > select ROUND(2.5) ; returns 2; > select ROUND(3.5) ; returns 4;....so on .=20 > I'm sure you would have figured out what's happening !!! Why ?? Because the IEEE float math standard says so. Round-to-nearest-even is considered good practice. > How do I get to approximate any number x.5 as x+1 ?? Try FLOOR(x + 0.5) if you really want the other behavior. regards, tom lane