Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 11:04 AM, Tom Lane wrote: Jan Wieck <[EMAIL PROTECTED]> writes: I agree that doing select 2::numeric ^ 100; should emit some sort of a warning. I do not. The conversion of 2::numeric to float is exact, so AFAICS the only way to do that would be to make *every* coercion of numeric

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > I agree that doing > select 2::numeric ^ 100; > should emit some sort of a warning. I do not. The conversion of 2::numeric to float is exact, so AFAICS the only way to do that would be to make *every* coercion of numeric to float emit a warning. This

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 11:18 PM, Jan Wieck wrote: I agree that doing select 2::numeric ^ 100; should emit some sort of a warning. Because what happens here is that the numeric value is degraded to a float8 in order to use the operator. Would this be solved by overloading the ^ operator with the

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Jan Wieck
On 8/31/2004 9:15 AM, Rajesh Kumar Mallah wrote: Michael Glaesemann wrote: On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Michael Glaesemann wrote: On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric arguments and returns numeric.

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 9:17 PM, Michael Glaesemann wrote: What you need is a power operation for numeric, which I think you'd have to write yourself, Looking a little closer, there is a pow() function that takes two numeric arguments and returns numeric.

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Michael Glaesemann wrote: On Aug 31, 2004, at 8:55 PM, Rajesh Kumar Mallah wrote: The docs says that numeric type supports numbers upto any precision However tradein_clients=# SELECT cast(2^100 as numeric); 1. Does the specs not require pgsql to print a warning or info , will it not be consi

Re: [SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Michael Glaesemann
On Aug 31, 2004, at 8:55 PM, Rajesh Kumar Mallah wrote: The docs says that numeric type supports numbers upto any precision However tradein_clients=# SELECT cast(2^100 as numeric); 1. Does the specs not require pgsql to print a warning or info , will it not be considered silient truncation of

[SQL] Arbitrary precision arithmatic with pgsql

2004-08-31 Thread Rajesh Kumar Mallah
Hi, The docs says that numeric type supports numbers upto any precision 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