Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

Round error when inserting double

$
0
0

Hi,

 

I have the following SQL Script.  This performs a simple insert of a rounded double value to 2 decimal places.  My problem is that the inserted value is not rounded correctly.  I am performing this task on HANA SP4 AWS

 

 

CREATE PROCEDURE PROC_TEST

language sqlscript as

k1 double;

begin

     -- this gives one row result of 0.28  (i checked that)

     select round(0.28748488447738373 , 2) from dummy

     into k1;

 

     -- this is where is goes bad

     INSERT INTO "mytable" VALUES(k1); 

END;

 

I have an inserted value of:  0.280000000003  

 

THAT IS WRONG.

Where did this rounding error come from? 

 

Cheers,

Steven.


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>