pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: wieck@debis.com
To: maillist@candle.pha.pa.us
Cc: wieck@debis.com
Cc: zot@zotconsulting.com
Cc: pgsql-sql@postgreSQL.org
Cc: jwieck@debis.com
Subject: Re: [SQL] Decimal precsion?
Date: Sat, 30 Oct 1999 18:37:30 +0200 (MET DST)
Message-ID: <m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <199910301555.LAA04741@candle.pha.pa.us>

> >     the column is declared as decimal with  4  digits  after  the
> >     decimal  point. Therefore, all values get rounded at the time
> >     of INSERT/UPDATE. The above looks numerically right to me.
> >
> >     Isn't  that  behaviour  correct?  Does  the  standard  define
> >     something else?
>
> OK, I wasn't sure on whether rounding was correct.
>
> However, the original message had DECIMAL(4,4) and he could insert 0.1,
> but not 0.0.

    The  rounding  is of course correct. Rounding 0.1234567 first
    to 0.123457 and then cutting of to 0.1234 is finally cutting,
    not rounding, and totally braindead. You only have to look at
    the digit after the last significant one.  In  this  case  we
    have  4  significant  digits,  so  we  must  look at digit 5,
    nothing else. Thus 0.1234500 is  0.1235  while  0.1234499  is
    0.1234 - end of story.

    The  other  one,  not  beeing able to insert 0.0, is surely a
    bug. Would you please put it onto the TODO?


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #





view thread (7+ messages)  latest in thread

Message-ID: <m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: wieck@debis.com, maillist@candle.pha.pa.us, zot@zotconsulting.com, jwieck@debis.com
  Subject: Re: [SQL] Decimal precsion?
  In-Reply-To: <m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de>
  References: <199910301555.LAA04741@candle.pha.pa.us> <m11hbVS-0003kLC@orion.SAPserv.Hamburg.dsh.de>

* 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