Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 1DEA1688CB1 for ; Sat, 26 Jun 2010 10:18:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 93740-09 for ; Sat, 26 Jun 2010 13:18:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtpcorp.com (smtpcorp.com [67.192.120.76]) by mail.postgresql.org (Postfix) with ESMTP id 0F60E643100 for ; Sat, 26 Jun 2010 10:18:43 -0300 (ADT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=smtpcorp.com; s=main; h=References:Message-ID:Date:Subject:From:To; bh=/bJfrXrszX9PfvbcLZ87DmfuO0Jiao1ql2qHMZbKQnw=; b=hOSxgTnCKxdbjTcgS05xbOvUswa/Nx1cZwDf4NV+wDwe3j85NkN/D+XIM61L2x1KRDsQPPN4BMR2bTBNB5DSo4OyrI63qu1Xsen1ibUYm+IuLEiVY5KRBc55XtdysCIi; Received: from ip-118-90-141-129.xdsl.xnet.co.nz ([118.90.141.129] helo=gonzo) by smtpcorp.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.70) id 1OSVHM-0007hx-RM; mid 144 for pgsql-sql@postgresql.org; Sat, 26 Jun 2010 13:18:17 +0000 Received: from news by gonzo with local (Exim 4.69) (envelope-from ) id 1OSVHD-0005Ft-3h for pgsql-sql@postgresql.org; Sun, 27 Jun 2010 01:18:31 +1200 To: pgsql-sql@postgresql.org Path: not-for-mail From: Jasen Betts Newsgroups: gmane.comp.db.postgresql.sql Subject: Re: Round integer division Date: 26 Jun 2010 13:18:30 GMT Organization: Dis (not Dat) Organisation Lines: 16 Message-ID: References: <4C25334D.4040805@gmail.com> <4C2536BC.4090306@gmail.com> NNTP-Posting-Host: localhost X-Trace: reversiblemaps.ath.cx 1277558310 19848 127.0.0.1 (26 Jun 2010 13:18:30 GMT) X-Face: ?)Aw4rXwN5u0~$nqKj`xPz>xHCwgi^q+^?Ri*+R(&uv2=E1Q0Zk(>h!~o2ID@6{uf8s; a +M[5[U[QT7xFN%^gR"=tuJw%TXXR'Fp~W; (T"1(739R%m0Yyyv*gkGoPA.$b,D.w:z+<'"=-lVT?6 {T?=R^:W5g|E2#EhjKCa+nt":4b}dU7GYB*HBxn&Td$@f%.kl^:7X8rQWd[NTc"P"u6nkisze/Q; 8 "9Z{peQF,w)7UjV$c|RO/mQW/NMgWfr5*$-Z%u46"/00mx-,\R'fLPe.)^ User-Agent: slrn/pre1.0.0-18 (Linux) X-Smtpcorp-Track: 5217027.1.23940162 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-5 required=5 tests=BAYES_50=0.8 X-Spam-Level: X-Archive-Number: 201006/107 X-Sequence-Number: 34298 On 2010-06-25, Lee Hachadoorian wrote: > > > On 06/25/2010 07:00 PM, Scott Marlowe wrote: >> That all floating point representations are approximate? >> > But if it's error due to approximation, shouldn't the result be random? > I tried this for a handful of larger numbers, and it appears to > consistently round to the even number. Wouldn't that have to be > intentionally programmed that way? Yes it is, an enginneer at intel made that decision in the 70s when the 8087 coprocessor was developed. If you're not running on x86-like hardware the round operation may do something different.