Re: [Info-Ingres] high precision calcs -
05-13-2010
, 03:19 AM
Hi Paul,
This is documented behavior. Later versions of Ingres increase the precision support from 31 to 39.
Regards,
Ian
________________________________
From: info-ingres-bounces (AT) kettleriver...ting (DOT) com [mailto:info-ingres-bounces (AT) kettleriverconsulting (DOT) com] On Behalf Of Paul White
Sent: 13 May 2010 08:29
To: Ingres and related product discussion forum
Subject: [Info-Ingres] high precision calcs
Hey experts,
I'm getting a packed decimal overflow multiplying high precision decimals. It seems I can't multiply two decimal numbers if the sum of their declared precision is greater than 31. Is this somewhere in the manual?
* select decimal(1.01 * 1.2081089504435315091605500,31,25)\g
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒ
col1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
1.2201900399479668242521555
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€…
* select decimal(1.01 * 1.2081089504435315091605500,31,30)\g
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒ
col1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
1.220190039947966824252155500000
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€…
* drop table pw;
* create table pw (v decimal(31,27), v1 decimal(31,27));
* commit;
* insert into pw values(1.01, 1.01);
* select * from pw;
* select v * v1 from pw;\g
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ˆ€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€ƒ
v v1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€Š€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€‡
1.010000000000000000000000000 1.010000000000000000000000000
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‰€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€…
(1 row)
E_AD1127 Packed Decimal overflow detected in query.
(Thu May 13 16:54:03 2010)
* create table pw (v decimal(31,25), v1 decimal(31,25))\g
* commit\g
* insert into pw values(1.01, 1.2081089504435315091605500)\g
* select * from pw\g
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ˆ€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€ƒ
v v1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€Š€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€‡
1.0100000000000000000000000 1.2081089504435315091605500
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‰€€€€€€€€€€€€€€€ €€€€€€€€€€€€€€€€€€…
* select v * v1 from pw;\g
E_AD1127 Packed Decimal overflow detected in query.
*
* drop table pw;
* create table pw (v decimal(5,3), v1 decimal(31,27));
* commit;
* insert into pw values(1.01, 1.2081089504435315091605500);
* select * from pw;
* select v * v1 from pw;\g
‚€€€€€€€ˆ€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒ
v v1
†€€€€€€€Š€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
1.010 1.208108950443531509160550000
„€€€€€€€‰€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€…
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒ
col1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
1.220190039947966824252155500000
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€…
* select 1.12345678901234567890 * 1.1234567890\g
‚€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€ƒ
col1
†€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€‡
1.262155156764060357775019052100
„€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€€…
* select 1.123456789012345678901 * 1.1234567890\g
E_AD1127 Packed Decimal overflow detected in query.
(Thu May 13 17:26:48 2010)
Is this correct behaviour?
Paul |