OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

odata message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Investigation into the behavior of arithmetic operators on Decimal type


I created a table with 6 columns in several different databases and one SaaS application. The columns are defined as follows.

 

COLA is Decimal (5,2)

COLB is Decimal (10,4)

XADD is COLA+COLB

XSUB is COLA-COLB

XMULT is COLA*COLB

XDIV is COLA/COLB

 

I populated COLA and COLB with the values 123.45 and 123456.7891 respectively and then fetched the data from all of the columns against the different databases and SaaS application. For the most part the results for all of the columns except XDIV were consistent. The results for XDIV were all over the place with regards to the scale of the result. Here are the results


Database

COLA

COLB

XADD

XSUB

XMULT

XDIV

Oracle

123.45  

123456.7891  

123580.2391                              

-123333.3391                             

15240740.614395                          

0.00099994500828954411872032074419145896 

SQL Server

123.45  

123456.7891  

123580.2391   

-123333.3391  

15240740.614395    

0.0009999450082

DB2

123.45   

123456.7891   

123580.2391    

-123333.3391   

15240740.614395    

0.000999945008289544118720

MySQL

123.45  

123456.7891  

123580.2391   

-123333.3391  

15240740.614395   

0.001000

PostgreSQL

123.45  

123456.7891  

123580.2391                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 

-123333.3391                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

15240740.614395                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             

0.00099994500828954412                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

Sybase

123.45  

123456.7891  

123580.2391   

-123333.3391  

15240740.614395    

0.0009999450082

Informix

123.45    

123456.7891   

123580.2391         

-123333.3391        

15240740.614395     

0.00099994500828954

Progress OpenEdge

123.45  

123456.7891  

123580.2391   

-123333.3391  

15240740.614395   

0.00099995

Salesforce

123.45                  

123456.7891             

123580.2391             

-123333.3391            

1.5240740614395E7       

9.99945008289544E-4

 

I also added this information as a comment to OData-784 however the table does not show up as well in the Jira issue.



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]