pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rajesh Kumar Mallah <mallah@trade-india.com>
To: pgsql-sql@postgresql.org
Subject: Arbitrary precision arithmatic with pgsql
Date: Tue, 31 Aug 2004 17:25:19 +0530
Message-ID: <41346727.8080901@trade-india.com> (raw)


Hi,

The docs says that numeric type supports numbers upto
any precision

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


However

tradein_clients=# SELECT  cast(2^100 as numeric);
+---------------------------------+
|             numeric             |
+---------------------------------+
| 1267650600228230000000000000000 |
+---------------------------------+
(1 row)
Time: 1036.063 ms

Naturally there is a loss of information here. So my question is

1. Does the specs not require pgsql to print a warning or info ,
   will it not be considered silient truncation of data.

2. Is there any way to do such calculation using pgsql, i understand
   bc is a better tool for it.

Warm Regards
Rajesh Kumar Mallah.

-- 

regds
Mallah.

Rajesh Kumar Mallah
+---------------------------------------------------+
| Tradeindia.com  (3,11,246) Registered Users 	    | 
| Indias' Leading B2B eMarketPlace                  |
| http://www.tradeindia.com/			    |
+---------------------------------------------------+




view thread (9+ messages)  latest in thread

Message-ID: <41346727.8080901@trade-india.com>
Permalink:  ../41346727.8080901@trade-india.com/
Also on:    postgresql.org/message-id/41346727.8080901@trade-india.com

 · 

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: mallah@trade-india.com
  Subject: Re: Arbitrary precision arithmatic with pgsql
  In-Reply-To: <41346727.8080901@trade-india.com>

* 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