pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: SZŰCS Gábor <surrano@mailbox.hu>
To: pgsql-sql@postgresql.org
Subject: Re: numeric and float converts to int differently?
Date: Tue, 28 Oct 2003 17:42:10 +0100
Message-ID: <074b01c39d72$6f512f90$0403a8c0@fejleszt4> (raw)
References: <072c01c39d65$65f83950$0403a8c0@fejleszt4>
	<20031028154536.GA29427@it.is.rice.edu>

Dear Ken,

reply goes to the list if you don't mind :)

----- Original Message ----- 
From: "Kenneth Marshall" <ktm@it.is.rice.edu>
To: "SZŰCS Gábor" <surrano@mailbox.hu>
Sent: Tuesday, October 28, 2003 4:45 PM


> Postgres is using the standard definition of rounding. What you

The "standard" definition I know states that 0.5 should round *up*, not
*away from zero*. i.e. 3.5 rounds (up) to 4, and -3.5 rounds (up) to -3. I
was just wondering if there is an explicit/official claim that Postgres does
round away from zero.

> 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.

This is why I asked if it's intentional/guaranteed, or undefined -- say, a
future change in glibc may cause this to change.

> I cannot imagine that the behavior would ever change.

If you can tell the developers' opinion for sure, that's enough for me :)

G.
------------------------------- cut here -------------------------------




view thread (7+ messages)  latest in thread

Message-ID: <074b01c39d72$6f512f90$0403a8c0@fejleszt4>
Permalink:  ../074b01c39d72$6f512f90$0403a8c0@fejleszt4/
Also on:    postgresql.org/message-id/074b01c39d72$6f512f90$0403a8c0@fejleszt4

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: surrano@mailbox.hu
  Subject: Re: numeric and float converts to int differently?
  In-Reply-To: <074b01c39d72$6f512f90$0403a8c0@fejleszt4>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox