X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id BFFD7D1B55D for ; Tue, 28 Oct 2003 20:18:30 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 59674-02 for ; Tue, 28 Oct 2003 16:18:01 -0400 (AST) Received: from mail.deltav.hu (oldmail.deltav.hu [213.163.0.192]) by svr1.postgresql.org (Postfix) with ESMTP id F0372D1B51A for ; Tue, 28 Oct 2003 16:17:58 -0400 (AST) Received: from fejleszt4 ([213.163.10.103]) by mail.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA6218 for ; Tue, 28 Oct 2003 21:17:58 +0100 Message-ID: <0acb01c39d90$6d9d9080$0403a8c0@fejleszt4> From: =?ISO-8859-1?Q?SZUCS_G=E1bor?= To: References: <072c01c39d65$65f83950$0403a8c0@fejleszt4><20031028154536.GA29427@it.is.rice.edu><074b01c39d72$6f512f90$0403a8c0@fejleszt4> <87brs1gr4y.fsf@stark.dyndns.tv> Subject: Re: numeric and float converts to int differently? Date: Tue, 28 Oct 2003 21:16:53 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/371 X-Sequence-Number: 15771 ----- Original Message ----- From: "Greg Stark" Sent: Tuesday, October 28, 2003 7:21 PM > > > cannot see is that the float values are not actually exactly 0.5 > > > > Yes I could guess that (floating point vs fixed), but is this a coincidence > > that both '0.5'::float and '-0.5'::float are closer to 0, whereas they could > > be closer to +/-1, as well as both closer to the lower or upper bound. > > Wouldn't 0.5 and -0.5 be representable exactly as floats? As Tom pointed out, it isn't a floating point failure -- it is how rounding float is implemented. I assume anything with less than 15 digits can be exactly represented as float. G. ------------------------------- cut here -------------------------------