db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendleton.de...@gmail.com>
Subject Re: Some questions about the Derby
Date Wed, 19 Dec 2012 15:44:34 GMT
Forwarding to the list.
On 12/19/2012 04:10 AM, 王旭 wrote:
> *Hello Pendleton*
> 
> **
> 
> *I am a loyal user of  derby database from China. I found some problems 
> in the course of use, so I need your help urgently.*
> 
> **
> 
> *Derby Version**:**10.4*
> 
> *Question one**:***
> 
> Firstly, I created a table.
> 
> CREATE TABLE CV
> 
>      (
> 
>          AGE INTEGER NOT NULL,
> 
>          RT DECIMAL(20,10),
> 
>          PRIMARY KEY (AGE)
> 
>      )
> 
> Then innserted data "insert into CV VALUES (80,10729.5000000000)"
> 
> Finally, an error occured when the SQL statement 
> "select?(95000.0*1000/1000)/1000.0?*?RT?from?CV?where?Age=80?" was 
> executed, it displayed  "the generated value has gone beyond the data 
> type of DECIMAL / NUMERIC (31,25)".
> 
> Could you tell me how Derby do the precision control and operation on 
> the data type of DECIMAL when it performs a variety of arithmetic 
> operations including add, subtract, multiply and divide?
> 
> *Question two**:***
> 
> Firstly, I created a table.
> 
> CREATE TABLE CV
> 
>      (
> 
>          AGE SMALLINT,
> 
>          RT DOUBLE,
> 
>          PRIMARY KEY (AGE)
> 
>      )
> 
> Then innserted data "insert into CV VALUES (20,766.3)"
> 
> Finally, I got results of "268204.99999999994" after executing the SQL 
> statement "select 350000.0/1000 * RT from CV the where age = 20?", but 
> the actual result should be "268205.0".
> 
> Could you tell me whether the cause of problem is inaccurated data from 
> a floating-point type double.
> 
> *Let me know whether the above problems are the Derby Bug? Are there any 
> other similar problems on the version in use? And how should we deal with?*
> 
> *Look forward to your reply, thank you!*
> 
>  From Apollo.Wong
> 


Mime
View raw message