Re: numeric/decimal docs bug? - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: numeric/decimal docs bug?
Date
Msg-id 200204130137.g3D1bY213251@candle.pha.pa.us
Whole thread Raw
In response to Re: numeric/decimal docs bug?  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-hackers
Tatsuo Ishii wrote:
> > Jan Wieck wrote:
> > > > The hard limit is certainly no more than 64K, since we store these
> > > > numbers in half of an atttypmod.  In practice I suspect the limit may
> > > > be less; Jan would be more likely to remember...
> > >
> > >     It is arbitrary of course. I don't recall completely, have to
> > >     dig into the code, but there might be some side  effect  when
> > >     mucking with it.
> > >
> > >     The NUMERIC code increases the actual internal precision when
> > >     doing multiply and divide, what  happens  a  gazillion  times
> > >     when  doing higher functions like trigonometry. I think there
> > >     was some connection between the max precision  and  how  high
> > >     this internal precision can grow, so increasing the precision
> > >     might affect the computational  performance  of  such  higher
> > >     functions significantly.
> >
> > Oh, interesting, maybe we should just leave it alone.
>
> So are we going to just fix the docs?

OK, I have updated the docs.  Patch attached.

I have also added this to the TODO list:

    * Change NUMERIC to enforce the maximum precision, and increase it

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: datatype.sgml
===================================================================
RCS file: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v
retrieving revision 1.87
diff -c -r1.87 datatype.sgml
*** datatype.sgml    3 Apr 2002 05:39:27 -0000    1.87
--- datatype.sgml    13 Apr 2002 01:26:54 -0000
***************
*** 506,518 ****
      <title>Arbitrary Precision Numbers</title>

      <para>
!      The type <type>numeric</type> can store numbers of practically
!      unlimited size and precision, while being able to store all
!      numbers and carry out all calculations exactly.  It is especially
!      recommended for storing monetary amounts and other quantities
!      where exactness is required.  However, the <type>numeric</type>
!      type is very slow compared to the floating-point types described
!      in the next section.
      </para>

      <para>
--- 506,517 ----
      <title>Arbitrary Precision Numbers</title>

      <para>
!      The type <type>numeric</type> can store numbers with up to 1,000
!      digits of precision and perform calculations exactly. It is
!      especially recommended for storing monetary amounts and other
!      quantities where exactness is required. However, the
!      <type>numeric</type> type is very slow compared to the
!      floating-point types described in the next section.
      </para>

      <para>

pgsql-hackers by date:

Previous
From: Neil Conway
Date:
Subject: Re: pg_dump is broken in CVS tip
Next
From: Bruce Momjian
Date:
Subject: Re: numeric/decimal docs bug?