dbTalk Databases Forums  

[Info-Ingres] high precision calcs

comp.databases.ingres comp.databases.ingres


Discuss [Info-Ingres] high precision calcs in the comp.databases.ingres forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Paul White
 
Posts: n/a

Default [Info-Ingres] high precision calcs - 05-13-2010 , 02:29 AM






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

Reply With Quote
  #2  
Old   
Ian Kirkham
 
Posts: n/a

Default 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

Reply With Quote
  #3  
Old   
Ingres Forums
 
Posts: n/a

Default Re: [Info-Ingres] high precision calcs - 05-13-2010 , 07:13 AM



Correct behaviour is documented at:
http://tinyurl.com/2d99fxx

Use of the decimal( ) function can be used to specify the result
scale/precision to avoid overflow if your data set should give know
scale/precisions. See
http://tinyurl.com/284h836

Regards

Alex


--
hanal04

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.